Subject: Re: bin/36229: uninitialized dkwedge_info structure in mount_mfs causes random failures
To: None <gnats-bugs@NetBSD.org, gnats-admin@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 04/27/2007 10:38:26
On Apr 27,  6:45am, gcw@primenet.com.au (gcw@primenet.com.au) wrote:
-- Subject: bin/36229: uninitialized dkwedge_info structure in mount_mfs caus

| >Number:         36229
| >Category:       bin
| >Synopsis:       uninitialized dkwedge_info structure in mount_mfs causes random failures
| >Confidential:   no
| >Severity:       serious
| >Priority:       medium
| >Responsible:    bin-bug-people
| >State:          open
| >Class:          sw-bug
| >Submitter-Id:   net
| >Arrival-Date:   Fri Apr 27 06:45:00 +0000 2007
| >Originator:     Geoff C. Wing
| >Release:        NetBSD 4.99.18
| >Organization:
| >Environment:
| System: NetBSD g.primenet.com.au 4.99.18 NetBSD 4.99.18 (G) #0: Tue Apr 24 18:09:38 EST 2007 gcw@g.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/G i386
| Architecture: i386
| Machine: i386
| >Description:
| 	A dkwedge_info structure in newfs is uninitialized when called as
| 	mount_mfs
| 
| 	Later checks for valid structure are against *.dkw_parent[0] (a char)
| 	being non-zero, so simple 0 fill of structure should suffice
| 
| >How-To-Repeat:
| 	.
| >Fix:
| 	
| --- sbin/newfs/newfs.c.org	2006-11-26 19:39:17.000000000 +1100
| +++ sbin/newfs/newfs.c	2007-04-27 15:20:23.000000000 +1000
| @@ -425,6 +425,7 @@
|  		usage();
|  
|  	memset(&sb, 0, sizeof sb);
| +	memset(&dkw, 0, sizeof dkw);
|  	special = argv[0];
|  	if (Fflag || mfs) {
|  		/*

I don't understand this. If getdiskinfo succeeds, dkw should be properly
initialized; if it fails then we exit.

christos