Subject: kern/24746: at24cxx eeprom driver has =/== bug
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <j.momose@ieee.org>
List: netbsd-bugs
Date: 03/11/2004 15:02:03
>Number:         24746
>Category:       kern
>Synopsis:       at24cxx eeprom driver has =/== bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 11 15:03:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jared Momose
>Release:        NetBSD-current
>Organization:
none
>Environment:
NetBSD kiwi.ams.apc.com 1.6ZF NetBSD 1.6ZF (CC405EP) #204: Thu Mar 11 03:47:22 EST 2004  jmomose@jaredlap.rrg.ams.apc.com:/usr/src-13NOV03/sys/arch/evbppc/compile/CC405EP evbppc
>Description:
The _write routine in the at24cxx eeprom driver has a =/== bug.
>How-To-Repeat:
Writing bytes to an at24cxx eeprom results in undetermined behavior.
>Fix:
Change the == to =. See the patch below:

---------------------- CUT HERE - patch-at24cxx -------------------
Index: src/sys/dev/i2c/at24cxx.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/at24cxx.c,v
retrieving revision 1.1
diff -u -r1.1 at24cxx.c
--- src/sys/dev/i2c/at24cxx.c	30 Sep 2003 00:35:31 -0000	1.1
+++ src/sys/dev/i2c/at24cxx.c	11 Mar 2004 14:47:29 -0000
@@ -281,7 +281,7 @@
 			cmdbuf[0] = AT24CXX_ADDR_HI(a);
 			cmdbuf[1] = AT24CXX_ADDR_LO(a);
 		}
-		if ((error == uiomove(&ch, 1, uio)) != 0) {
+		if ((error = uiomove(&ch, 1, uio)) != 0) {
 			iic_release_bus(sc->sc_tag, 0);
 			return (error);
 		}
---------------------- END ----------------------------------------


>Release-Note:
>Audit-Trail:
>Unformatted: