[PATCH] fix integer overflow warning in i2o_block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 <[email protected]>

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 ([email protected])
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux