Module Name:    src
Committed By:   martin
Date:           Thu Jan 19 10:57:50 UTC 2023

Modified Files:
        src/sys/dev/usb [netbsd-8]: usb.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.115.6.1 src/sys/dev/usb/usb.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usb.h
diff -u src/sys/dev/usb/usb.h:1.115 src/sys/dev/usb/usb.h:1.115.6.1
--- src/sys/dev/usb/usb.h:1.115	Thu Jan 19 16:05:00 2017
+++ src/sys/dev/usb/usb.h	Thu Jan 19 10:57:50 2023
@@ -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 @@ typedef uint8_t uDWord[4];
 #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), \

Reply via email to