[SCSI] advansys: Fix bug in AdvLoadMicrocode

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>
This commit is contained in:
Matthew Wilcox 2007-10-05 15:57:06 -04:00 committed by James Bottomley
parent ce4796d1e1
commit 951b62c11e
1 changed files with 1 additions and 1 deletions

View File

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