summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-08-12 19:13:36 +0000
committerriastradh <riastradh@NetBSD.org>2022-08-12 19:13:36 +0000
commiteeae2d6aafc0b732a8b8ab0149bbbb7a4debe335 (patch)
treea38335a14a0bcc0d642cc5f7efe4edc0429d7220 /sys/dev/usb
parenta09d95c96c0a7fc46ed16c26baf067157845fee4 (diff)
rum(4): Avoid uninitialized garbage in failed register read.
Reported-by: syzbot+f2cba71b1b1bc91029b3@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=7a01863d0fe34a4946516388c436991ba2beaa63
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_rum.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index 73af8f14ff2..d9fc1ff4b24 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -1,5 +1,5 @@
/* $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $ */
-/* $NetBSD: if_rum.c,v 1.69 2020/03/15 23:04:50 thorpej Exp $ */
+/* $NetBSD: if_rum.c,v 1.70 2022/08/12 19:13:36 riastradh Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.69 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.70 2022/08/12 19:13:36 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1407,6 +1407,7 @@ rum_eeprom_read(struct rum_softc *sc, uint16_t addr, void *buf, int len)
if (error != 0) {
printf("%s: could not read EEPROM: %s\n",
device_xname(sc->sc_dev), usbd_errstr(error));
+ memset(buf, 0, len);
}
}
@@ -1436,6 +1437,7 @@ rum_read_multi(struct rum_softc *sc, uint16_t reg, void *buf, int len)
if (error != 0) {
printf("%s: could not multi read MAC register: %s\n",
device_xname(sc->sc_dev), usbd_errstr(error));
+ memset(buf, 0, len);
}
}