diff options
author | Borislav Petkov <bp@suse.de> | 2022-04-05 18:15:13 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-21 19:33:56 +0300 |
commit | 8d084b2eae7fc5fcfc9f143cd7321a88e1cd76aa (patch) | |
tree | b05ab9fd30581afcc9655289706976e4fc90c2df | |
parent | 9e3d68f872e4f5ce40dcc5baba7e37ab7961ed74 (diff) | |
download | linux-8d084b2eae7fc5fcfc9f143cd7321a88e1cd76aa.tar.xz |
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%2BtIH8GQpuct@zn.tnic for the gory
details as to why it triggers with older gccs only.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Link: https://lore.kernel.org/r/20220405151517.29753-8-bp@alien8.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | include/linux/usb/pd_bdo.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/usb/pd_bdo.h b/include/linux/usb/pd_bdo.h index 033fe3e17141..7c25b88d79f9 100644 --- a/include/linux/usb/pd_bdo.h +++ b/include/linux/usb/pd_bdo.h @@ -15,7 +15,7 @@ #define BDO_MODE_CARRIER2 (5 << 28) #define BDO_MODE_CARRIER3 (6 << 28) #define BDO_MODE_EYE (7 << 28) -#define BDO_MODE_TESTDATA (8 << 28) +#define BDO_MODE_TESTDATA (8U << 28) #define BDO_MODE_MASK(mode) ((mode) & 0xf0000000) |