Skip to content

Commit 8d084b2

Browse files
suryasaimadhugregkh
authored andcommitted
usb: typec: tcpm: Fix undefined behavior due to shift overflowing the constant
Fix: drivers/usb/typec/tcpm/tcpm.c: In function ‘run_state_machine’: drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant case BDO_MODE_TESTDATA: ^~~~ See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only. Signed-off-by: Borislav Petkov <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9e3d68f commit 8d084b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/usb/pd_bdo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define BDO_MODE_CARRIER2 (5 << 28)
1616
#define BDO_MODE_CARRIER3 (6 << 28)
1717
#define BDO_MODE_EYE (7 << 28)
18-
#define BDO_MODE_TESTDATA (8 << 28)
18+
#define BDO_MODE_TESTDATA (8U << 28)
1919

2020
#define BDO_MODE_MASK(mode) ((mode) & 0xf0000000)
2121

0 commit comments

Comments
 (0)