Subject: kern/36673: dubious code in sysmon_envsys
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 07/21/2007 11:35:00
>Number:         36673
>Category:       kern
>Synopsis:       dubious code is sysmon_envsys
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 21 11:35:00 +0000 2007
>Originator:     YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release:        NetBSD 4.99.24
>Organization:
	
>Environment:
	
	
Architecture: i386
Machine: i386
>Description:
	- sme_register_sensorname doesn't need to handle EMPTY case specially.

	- sme_make_dictionary should fully set up a dictionary before
	 adding it to the array.  (instead of leaving a partial dictionary
	 on errors.)
	 same for sysmon_envsys_createplist and its array.

	- ENVSYS_FDUPDESC seems broken for compat ioctls.

	- what global mutexes like sme_mtx protect is not clear.

	- 'obj' argument of sme_sensor_upstring (and similar functions)
	 is useless.

	- '--sme->sme_nsensors' in sme_update_dictionary seems quite dubious.

	- sysmon_envsys_createplist seems to ignore most errors
	 unless it was for the last sensor in sme_sensor_data[].
	 i don't understand why the last one is special.

>How-To-Repeat:
	code inspection.
>Fix:
	

>Unformatted: