All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: linux-i2c@vger.kernel.org
Cc: Tharun Kumar P <tharunkumar.pasumarthi@microchip.com>,
	UNGLinuxDriver@microchip.com, Wolfram Sang <wsa@kernel.org>
Subject: [PATCH] i2c: pci1xxxx: prevent signed integer overflow
Date: Wed, 28 Sep 2022 22:12:14 +0200	[thread overview]
Message-ID: <20220928201214.8544-1-wsa@kernel.org> (raw)

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


             reply	other threads:[~2022-09-28 20:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 20:12 Wolfram Sang [this message]
2022-10-01 22:59 ` [PATCH] i2c: pci1xxxx: prevent signed integer overflow Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220928201214.8544-1-wsa@kernel.org \
    --to=wsa@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=tharunkumar.pasumarthi@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.