Subject: bin/30411: fsck_lfs uninitalized vars in pass6.c::rfw_update_single()
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <lukem@NetBSD.org>
List: netbsd-bugs
Date: 06/03/2005 06:31:00
>Number:         30411
>Category:       bin
>Synopsis:       fsck_lfs uninitalized vars in pass6.c::rfw_update_single()
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 03 06:31:00 +0000 2005
>Originator:     Luke Mewburn
>Release:        NetBSD 3.0_BETA
>Organization:
TNF
>Environment:
Architecture: i386
Machine: i386
>Description:
	When compiling fsck_lfs/pass6.c with -Wuninitalized, the
	following warnings are triggered:

    pass6.c: In function `rfw_update_single':
    pass6.c:93: warning: `osize' might be used uninitialized in this function
    pass6.c:93: warning: `obb' might be used uninitialized in this function

	My examination of the code shows that just initializing these
	to 0 at the start of the function to appease the warning
	isn't necessarily "safe", because:

	    *	osize isn't set if daddr <= 0, yet it's possibly used
		when daddr >= 0 later on.
		(I.e, osize isn't initialized yet is used when daddr == 0)

	    *	obb is only set in some circumstances but is used to
		update bfree accounting.

	I don't understand the LFS code enough to fix this correctly.

>How-To-Repeat:
	Compile with -Wuninitialized.
	(See PR 30394 for a related problem).
	
>Fix:
	very carefully.