From enami@enami.ba2.so-net.or.jp  Sun May  5 00:19:12 1996
Received: from mail.ba2.so-net.or.jp (mail.ba2.so-net.or.jp [202.238.95.33])
          by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id AAA03437
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 5 May 1996 00:18:54 -0700 (PDT)
Received: from euphoria.enami.ba2.so-net.or.jp (root@ppp582a.ykhm.ap.so-net.or.jp [202.238.88.42]) by mail.ba2.so-net.or.jp (8.7.5/3.4W396011914) with ESMTP id QAA15066 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 5 May 1996 16:18:50 +0900
Received: (from enami@localhost) by euphoria.enami.ba2.so-net.or.jp (8.7.5/3.4W4-euphoria) id PAA12300; Sun, 5 May 1996 15:25:27 +0900 (JST)
Message-Id: <199605050625.PAA12300@euphoria.enami.ba2.so-net.or.jp>
Date: Sun, 5 May 1996 15:25:27 +0900 (JST)
From: enami@ba2.so-net.or.jp
Reply-To: enami@ba2.so-net.or.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: uninitialized auto variable shmseg is used in shget_allocate_segment
X-Send-Pr-Version: 3.2

>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:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May  5 00:20:01 PDT 1996
>Closed-Date:    Sun May 5 15:54:02 MET DST 1996
>Last-Modified:  Sun May  5 15:54:40 MET DST 1996
>Originator:     enami tsugutomo
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
>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) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun May 5 15:54:02 MET DST 1996 
State-Changed-Why:  
Suggested fix applied in rev 1.21 of sysv_shm.c. 

>Unformatted:
 
