Subject: kern/36673: dubious code in sysmon_envsys
To: None <,,>
From: None <>
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 <>
>Release:        NetBSD 4.99.24
Architecture: i386
Machine: i386
	- 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.

	code inspection.