lkml.org 
[lkml]   [2007]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fix integer overflow warning in i2o_block
> 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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-27 17:49    [W:0.040 / U:1.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site