From nobody@FreeBSD.org  Tue Aug 10 01:59:25 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 66F0116A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 10 Aug 2004 01:59:24 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5ED6B43D4C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 10 Aug 2004 01:59:24 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i7A1xN8Y088861
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 10 Aug 2004 01:59:23 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i7A1xNQi088858;
	Tue, 10 Aug 2004 01:59:23 GMT
	(envelope-from nobody)
Message-Id: <200408100159.i7A1xNQi088858@www.freebsd.org>
Date: Tue, 10 Aug 2004 01:59:23 GMT
From: Matthew Luckie <mjl@luckie.org.nz>
To: freebsd-gnats-submit@FreeBSD.org
Subject: uninitialised parameters passed to kernel_sysctl
X-Send-Pr-Version: www-2.3

>Number:         70236
>Category:       kern
>Synopsis:       [patch] uninitialised parameters passed to kernel_sysctl [nwfs_vfsops.c smb_subr.c]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 10 02:00:38 GMT 2004
>Closed-Date:    Fri Dec 17 13:39:14 GMT 2004
>Last-Modified:  Fri Dec 17 13:39:14 GMT 2004
>Originator:     Matthew Luckie
>Release:        FreeBSD 4.10
>Organization:
University of Waikato
>Environment:
FreeBSD lycra.luckie.org.nz 4.10-RELEASE-p2 FreeBSD 4.10-RELEASE-p2 #7: Wed Jul 28 08:39:51 NZST 2004     root@lycra.luckie.org.nz:/files/freebsd_src/sys/compile/lycra  i386
>Description:
      I found two instances of kernel_sysctl being called without olen being set.
>How-To-Repeat:
      N/A
>Fix:
--- sys/nwfs/nwfs_vfsops.c.orig	Tue Aug 10 13:51:32 2004
+++ sys/nwfs/nwfs_vfsops.c	Tue Aug 10 13:51:52 2004
@@ -394,6 +394,7 @@
 
 	name[0] = CTL_HW;
 	name[1] = HW_NCPU;
+	olen = sizeof(ncpu);
 	error = kernel_sysctl(curproc, name, 2, &ncpu, &olen, NULL, 0, &plen);
 	if (error == 0 && ncpu > 1)
 		printf("warning: nwfs module compiled without SMP support.");


--- sys/netsmb/smb_subr.c.orig	Tue Aug 10 13:49:14 2004
+++ sys/netsmb/smb_subr.c	Tue Aug 10 13:50:14 2004
@@ -375,6 +375,7 @@
 
 	name[0] = CTL_HW;
 	name[1] = HW_NCPU;
+	olen = sizeof(ncpu);
 	error = kernel_sysctl(curproc, name, 2, &ncpu, &olen, NULL, 0, &plen);
 	if (error)
 		return error;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: bp 
State-Changed-When: Fri Dec 17 13:37:38 GMT 2004 
State-Changed-Why:  
Fixed in a slightly different way in RELENG_4 and will be MFC'ed 
shortly to RELENG_4_11. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70236 
>Unformatted:
