]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] advansys: Fix bug in AdvLoadMicrocode
authorMatthew Wilcox <matthew@wil.cx>
Fri, 5 Oct 2007 19:57:06 +0000 (15:57 -0400)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 7 Mar 2008 16:05:43 +0000 (10:05 -0600)
buf[i] can be up to 0xfd, so doubling it and assigning the result to an
unsigned char truncates the value.  Just use an unsigned int instead;
it's only a temporary.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/advansys.c

index 3c2d6888bb8c36326e79703c69663486228d85c4..8591585e5cc55c27669a004c48c048521a3dc9e4 100644 (file)
@@ -6439,7 +6439,7 @@ static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size,
                        i += 2;
                        len += 2;
                } else {
-                       unsigned char off = buf[i] * 2;
+                       unsigned int off = buf[i] * 2;
                        unsigned short word = (buf[off + 1] << 8) | buf[off];
                        AdvWriteWordAutoIncLram(iop_base, word);
                        len += 2;