From: Jonathan Gray Subject: simplify bit shift in xhci(4) To: tech@openbsd.org Date: Mon, 22 Apr 2024 22:12:59 +1000 prompted by: kubsan: dev/usb/xhci.c:1094:18: shift: left shift of 255 by 24 places cannot be represented in type 'int' Index: sys/dev/usb/xhcireg.h =================================================================== RCS file: /cvs/src/sys/dev/usb/xhcireg.h,v diff -u -p -r1.18 xhcireg.h --- sys/dev/usb/xhcireg.h 9 Jan 2022 05:43:02 -0000 1.18 +++ sys/dev/usb/xhcireg.h 22 Apr 2024 11:21:18 -0000 @@ -335,7 +335,7 @@ struct xhci_inctx { struct xhci_trb { uint64_t trb_paddr; -#define XHCI_TRB_PORTID(x) (((x) & (0xff << 24)) >> 24) /* Port ID */ +#define XHCI_TRB_PORTID(x) (((x) >> 24) & 0xff) /* Port ID */ #define XHCI_TRB_MAXSIZE (64 * 1024) uint32_t trb_status;