Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 May 1996 15:25:27 +0900 (JST)
From:      enami@ba2.so-net.or.jp
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/1174: uninitialized auto variable shmseg is used in shget_allocate_segment
Message-ID:  <199605050625.PAA12300@euphoria.enami.ba2.so-net.or.jp>
Resent-Message-ID: <199605050720.AAA03518@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1174
>Category:       kern
>Synopsis:       uninitialized auto variable shmseg is used in shget_allocate_segment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May  5 00:20:01 PDT 1996
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
>Release:        FreeBSD 2.2-CURRENT i386
>Environment:

	FreeBSD current around 1996 May 4 (GMT+0900)

>Description:

When compiling kern/sysv_shm.c, compile gives following warning.

cc -c -O -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit  -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes  -Winline  -nostdinc -I. -I../.. -I../../sys -I../../../include -DI386_CPU -DI486_CPU -DDIAGNOSTIC -DCOMPAT_43 -DCD9660 -DNFS -DFFS -DINET -DKERNEL  ../../kern/sysv_shm.c
../../kern/sysv_shm.c: In function `shmget_allocate_segment':
../../kern/sysv_shm.c:459: warning: `shmseg' might be used uninitialized in this function

>How-To-Repeat:

Compile kernel with option SYSVSHM.

>Fix:

I think it is a typo introduced during sysv_shm.c 1.18 and 1.19.  Here is
a diff to correct it.
	
Index: sysv_shm.c
===================================================================
RCS file: /mnt/freebsd/src/sys/kern/sysv_shm.c,v
retrieving revision 1.20
diff -u -r1.20 sysv_shm.c
--- sysv_shm.c	1996/05/03 21:01:24	1.20
+++ sysv_shm.c	1996/05/05 05:36:00
@@ -463,7 +463,7 @@
 		return EINVAL;
 	if (shm_nused >= shminfo.shmmni) /* any shmids left? */
 		return ENOSPC;
-	size = round_page(shmseg->shm_segsz);
+	size = round_page(uap->size);
 	if (shm_committed + btoc(size) > shminfo.shmall)
 		return ENOMEM;
 	if (shm_last_free < 0) {
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605050625.PAA12300>