Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db7526f9 authored by Meelis Roos's avatar Meelis Roos Committed by Linus Torvalds
Browse files

fix integer overflow warning in i2o_block



drivers/message/i2o/i2o_block.c: In function 'i2o_block_transfer':
drivers/message/i2o/i2o_block.c:837: warning: integer overflow in expression

msg->u.head[1] = cpu_to_le32(I2O_CMD_PRIVATE << 24 | HOST_TID << 12 | tid);
and I2O_CMD_PRIVATE is defined as 0xFF.  This gets "0xFF0100 | tid" and fits
into 32-bit unsigned but not into 32-bit signed integer properly.  Target
value is defined as u32 so the claculation does not fit during computation.

Change local variable tid to u32 so the whole expression is of u32 type and
fits well into u32 result.

Signed-off-by: default avatarMeelis Roos <mroos@linux.ee>
Cc: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ad4a5bb8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;