Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Fix evil "sizeof(void*)" botch
details: https://anonhg.NetBSD.org/src/rev/73e8ec3bed9f
branches: trunk
changeset: 789916:73e8ec3bed9f
user: martin <martin%NetBSD.org@localhost>
date: Thu Sep 12 20:30:58 2013 +0000
description:
Fix evil "sizeof(void*)" botch
diffstat:
sys/dev/i2c/i2c_exec.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 3c05026f4cc6 -r 73e8ec3bed9f sys/dev/i2c/i2c_exec.c
--- a/sys/dev/i2c/i2c_exec.c Thu Sep 12 20:20:03 2013 +0000
+++ b/sys/dev/i2c/i2c_exec.c Thu Sep 12 20:30:58 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c_exec.c,v 1.8 2012/04/22 14:10:36 pgoyette Exp $ */
+/* $NetBSD: i2c_exec.c,v 1.9 2013/09/12 20:30:58 martin Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.8 2012/04/22 14:10:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.9 2013/09/12 20:30:58 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -90,8 +90,9 @@
case 2:
break;
default:
- memcpy(data, vbuf, sizeof(vbuf));
- data[sizeof(vbuf)] = iic_smbus_pec(2, b, data);
+ KASSERT(buflen+1 < sizeof(data));
+ memcpy(data, vbuf, buflen);
+ data[buflen] = iic_smbus_pec(2, b, data);
buflen++;
break;
}
Home |
Main Index |
Thread Index |
Old Index