Subject: Re: experiences with recent -current
To: None <current-users@netbsd.org>
From: None <fukumoto@imasy.or.jp>
List: current-users
Date: 03/26/2007 00:55:14
>> Replacing memcpy in aiboost_getcomp() with strlcpy seems to fix it.
>> But envstat shows the fan speeds are 0.
>> 

This was easy to fix.

						FUKUMOTO Atsushi
						fukumoto@imasy.or.jp


Index: sys/dev/acpi/aiboost.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/aiboost.c,v
retrieving revision 1.2
diff -u -u -r1.2 aiboost.c
--- sys/dev/acpi/aiboost.c	18 Mar 2007 22:36:11 -0000	1.2
+++ sys/dev/acpi/aiboost.c	25 Mar 2007 15:53:03 -0000
@@ -251,7 +251,7 @@
 
 	/* Fan */
 	for (i = 0; i < sc->sc_aifan->num; i++, j++) {
-		val = aiboost_get_value(h, "RFAN", sc->sc_aitemp->elem[i].id);
+		val = aiboost_get_value(h, "RFAN", sc->sc_aifan->elem[i].id);
 		sc->sc_data[j].cur.data_us = val ;
 		DPRINTF(("%s: fan[%d] val=%d j=%d\n", __func__, i, val, j));
 	}
@@ -387,8 +387,7 @@
 		DPRINTF(("%s: id=%d str=%s\n",
 		    __func__, c->elem[i - 1].id, str));
 
-		(void)memcpy(&c->elem[i - 1].desc, str,
-		    sizeof(c->elem[i - 1].desc));
+		strlcpy(c->elem[i-1].desc, str, sizeof(c->elem[i-1].desc));
 
 		if (buf2.Pointer)
 			AcpiOsFree(buf2.Pointer);