Skip to content

Commit

Permalink
[SCSI] advansys: Fix bug in AdvLoadMicrocode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Wilcox authored and James Bottomley committed Mar 7, 2008
1 parent ce4796d commit 951b62c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/advansys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 951b62c

Please sign in to comment.