summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-07-15 16:13:11 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-07-15 16:13:11 +0000
commit431b9de171033566fdc29a12e7681b3cfab15d55 (patch)
treed69c5eee6c70389e718170f2e35f51a01c9d2b7d /sys
parent8bc09206f301281d1df09ef8d0ad8a63dc4ed313 (diff)
Insist that callers use atw_write_sram to copy even-length buffers
to even offsets in the ADM8211 SRAM. From NetBSD (dyoung).
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/atw.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index 3e2c366df4f..de797105ad6 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: atw.c,v 1.19 2004/07/15 16:11:51 millert Exp $ */
-/* $NetBSD: atw.c,v 1.64 2004/07/15 07:26:17 dyoung Exp $ */
+/* $OpenBSD: atw.c,v 1.20 2004/07/15 16:13:10 millert Exp $ */
+/* $NetBSD: atw.c,v 1.65 2004/07/15 07:31:05 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.64 2004/07/15 07:26:17 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.65 2004/07/15 07:31:05 dyoung Exp $");
#endif
#include "bpfilter.h"
@@ -2028,15 +2028,9 @@ atw_write_sram(struct atw_softc *sc, u_int ofs, u_int8_t *buf, u_int buflen)
memcpy(&sc->sc_sram[ofs], buf, buflen);
- if (ofs % 2 != 0) {
- ofs--;
- buflen++;
- }
-
- if (buflen % 2 != 0)
- buflen++;
+ KASSERT(ofs % 2 == 0 && buflen % 2 == 0);
- assert(buflen + ofs <= ATW_SRAM_SIZE);
+ KASSERT(buflen + ofs <= ATW_SRAM_SIZE);
ptr = &sc->sc_sram[ofs];