mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Meelis Roos <mroos@linux.ee>
To: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix integer overflow warning in i2o_block
Date: Fri, 27 Jul 2007 18:45:53 +0300 (EEST)	[thread overview]
Message-ID: <Pine.SOC.4.64.0707271842330.27338@math.ut.ee> (raw)
In-Reply-To: <AE4F746F2AECFC4DA4AADD66A1DFEF01C5B32D@otce2k301.adaptec.com>

> I would change tid from an int to an unsigned instead, he is the culprit
> that is promoting the unsigned to an signed.

Thanks, this is the culprit.

> >   CC [M]  drivers/message/i2o/i2o_block.o
> > drivers/message/i2o/i2o_block.c: In function 'i2o_block_transfer':
> > drivers/message/i2o/i2o_block.c:837: warning: integer 
> > overflow in expression

The patch below changes local variable tid to u32 so the whole 
expression is of u32 type and fits well into u32 result. Compile tested 
only since I have currently no extra I2O hardware available for testing.

Signed-off-by: Meelis Roos <mroos@linux.ee>

diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 5e1c99f..50b2c73 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -744,7 +744,7 @@ static int i2o_block_transfer(struct request *req)
 {
 	struct i2o_block_device *dev = req->rq_disk->private_data;
 	struct i2o_controller *c;
-	int tid = dev->i2o_dev->lct_data.tid;
+	u32 tid = dev->i2o_dev->lct_data.tid;
 	struct i2o_message *msg;
 	u32 *mptr;
 	struct i2o_block_request *ireq = req->special;

-- 
Meelis Roos (mroos@linux.ee)

      reply	other threads:[~2007-07-27 15:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 20:30 integer overflow " Meelis Roos
2007-07-26 20:48 ` Salyzyn, Mark
2007-07-27 15:45   ` Meelis Roos [this message]

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=Pine.SOC.4.64.0707271842330.27338@math.ut.ee \
    --to=mroos@linux.ee \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark_salyzyn@adaptec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®