Skip to contentSkip to conversation

i2c: pci1xxxx: prevent signed integer overflow

PATCH Applied Wolfram Sang 1 participant 2 messages Sep 28, 2022 – Oct 1, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: pci1xxxx: prevent signed integer overflow

Some constants need 'UL' markings, otherwise they are shifted into the sign bit.

Fixes 361693697249 ("i2c: microchip: pci1xxxx: Add driver for I2C host controller in multifunction endpoint of pci1xxxx switch")
---
 drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-mchp-pci1xxxx.c +3 -3
index b2b7dbff5ef4..f5342201eb6b 100644
@@ -190,9 +190,9 @@
  * Bus Idle Minimum time = BUS_IDLE_MIN[7:0] x Baud_Clock_Period x
  * (BUS_IDLE_MIN_XK_TICKS[7] ? 4,1)
  */
-#define BUS_IDLE_MIN_100K_TICKS		167
-#define BUS_IDLE_MIN_400K_TICKS		139
-#define BUS_IDLE_MIN_1000K_TICKS		133
+#define BUS_IDLE_MIN_100K_TICKS		167UL
+#define BUS_IDLE_MIN_400K_TICKS		139UL
+#define BUS_IDLE_MIN_1000K_TICKS		133UL
 
 /*
  * CTRL_CUM_TIME_OUT_XK_TICKS defines SMBus Controller Cumulative Time-Out.
Signature · 1 line
2.35.1
author Applied
#1 lore raw
Quoted 5 lines · Wolfram Sang

Some constants need 'UL' markings, otherwise they are shifted into the sign bit.

Fixes 361693697249 ("i2c: microchip: pci1xxxx: Add driver for I2C host controller in multifunction endpoint of pci1xxxx switch")

Applied to for-next, thanks!