linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: pci1xxxx: prevent signed integer overflow
@ 2022-09-28 20:12 Wolfram Sang
  2022-10-01 22:59 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2022-09-28 20:12 UTC (permalink / raw)
  To: linux-i2c; +Cc: Tharun Kumar P, UNGLinuxDriver, 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")
Signed-off-by: Wolfram Sang <wsa@kernel.org>
---
 drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
index b2b7dbff5ef4..f5342201eb6b 100644
--- a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
+++ b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
@@ -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.
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: pci1xxxx: prevent signed integer overflow
  2022-09-28 20:12 [PATCH] i2c: pci1xxxx: prevent signed integer overflow Wolfram Sang
@ 2022-10-01 22:59 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2022-10-01 22:59 UTC (permalink / raw)
  To: linux-i2c; +Cc: Tharun Kumar P, UNGLinuxDriver

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

On Wed, Sep 28, 2022 at 10:12:14PM +0200, Wolfram Sang wrote:
> 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")
> Signed-off-by: Wolfram Sang <wsa@kernel.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-01 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-28 20:12 [PATCH] i2c: pci1xxxx: prevent signed integer overflow Wolfram Sang
2022-10-01 22:59 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).