Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Check range of EEPROM address rather truncate im...



details:   https://anonhg.NetBSD.org/src/rev/508edffa61eb
branches:  trunk
changeset: 993529:508edffa61eb
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Sep 16 01:56:29 2018 +0000

description:
Check range of EEPROM address rather truncate implicitly.

diffstat:

 sys/dev/usb/if_mue.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 0ecb1e586665 -r 508edffa61eb sys/dev/usb/if_mue.c
--- a/sys/dev/usb/if_mue.c      Sun Sep 16 01:44:11 2018 +0000
+++ b/sys/dev/usb/if_mue.c      Sun Sep 16 01:56:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mue.c,v 1.16 2018/09/16 01:44:11 rin Exp $  */
+/*     $NetBSD: if_mue.c,v 1.17 2018/09/16 01:56:29 rin Exp $  */
 /*     $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $  */
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.16 2018/09/16 01:44:11 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.17 2018/09/16 01:56:29 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -473,8 +473,9 @@
                return ETIMEDOUT;
        }
 
+       KASSERT((off & ~MUE_E2P_CMD_ADDR_MASK) == 0);
        mue_csr_write(sc, MUE_E2P_CMD, MUE_E2P_CMD_READ | MUE_E2P_CMD_BUSY |
-           (off & MUE_E2P_CMD_ADDR_MASK));
+           off);
 
        if (MUE_WAIT_CLR(sc, MUE_E2P_CMD, MUE_E2P_CMD_BUSY,
            MUE_E2P_CMD_TIMEOUT)) {



Home | Main Index | Thread Index | Old Index