]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
SCSI advansys: Fix bug in AdvLoadMicrocode
authorMatthew Wilcox <matthew@wil.cx>
Fri, 21 Mar 2008 15:15:03 +0000 (15:15 +0000)
committerChris Wright <chrisw@sous-sol.org>
Mon, 24 Mar 2008 18:48:30 +0000 (11:48 -0700)
commit: 951b62c11e86acf8c55d9828aa8c921575023c29

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>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/advansys.c

index ce8ccb04540d85b04db825224a5dc02bd382de8a..f40417b9517e6167e78132c286c4d2e505e9a37b 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;