Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/usb Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/ef5adbd2f3ca
branches:  netbsd-9
changeset: 370137:ef5adbd2f3ca
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Sep 18 13:34:06 2022 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1529):

        sys/dev/usb/usb.h: revision 1.121

Cast to uint32_t to avoid undefined behavior in UGETDW(). Found by kUBSan.

diffstat:

 sys/dev/usb/usb.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 654898a4746b -r ef5adbd2f3ca sys/dev/usb/usb.h
--- a/sys/dev/usb/usb.h Sun Sep 18 13:32:27 2022 +0000
+++ b/sys/dev/usb/usb.h Sun Sep 18 13:34:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.h,v 1.116.6.1 2019/09/01 13:00:37 martin Exp $     */
+/*     $NetBSD: usb.h,v 1.116.6.2 2022/09/18 13:34:06 martin Exp $     */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,8 @@
 #define UGETW(w) ((w)[0] | ((w)[1] << 8))
 #define USETW(w,v) ((w)[0] = (uint8_t)(v), (w)[1] = (uint8_t)((v) >> 8))
 #define USETWD(val) { (uint8_t)(val), (uint8_t)((val) >> 8) }
-#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24))
+#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) |   \
+           ((uint32_t)(w)[3] << 24))
 #define USETDW(w,v) ((w)[0] = (uint8_t)(v), \
                     (w)[1] = (uint8_t)((v) >> 8), \
                     (w)[2] = (uint8_t)((v) >> 16), \



Home | Main Index | Thread Index | Old Index