Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/260b44b06149
branches:  netbsd-8
changeset: 373122:260b44b06149
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jan 19 10:57:50 2023 +0000

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

        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 48d41062a39e -r 260b44b06149 sys/dev/usb/usb.h
--- a/sys/dev/usb/usb.h Thu Jan 19 10:55:47 2023 +0000
+++ b/sys/dev/usb/usb.h Thu Jan 19 10:57:50 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.h,v 1.115 2017/01/19 16:05:00 skrll Exp $  */
+/*     $NetBSD: usb.h,v 1.115.6.1 2023/01/19 10:57:50 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