Skip to content

Commit

Permalink
Staging: rts_pstor: fix read past end of buffer
Browse files Browse the repository at this point in the history
We read one space past the end of the buffer because we add 1.

Also I changed it to use ARRAY_SIZE() instead of manually calculating
the size.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Feb 9, 2011
1 parent 581de3b commit 7e79f78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/rts_pstor/ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -3361,7 +3361,7 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32
log_blk = (u16)(start_sector >> ms_card->block_shift);
start_page = (u8)(start_sector & ms_card->page_off);

for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) {
for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1; seg_no++) {
if (log_blk < ms_start_idx[seg_no+1])
break;
}
Expand Down

0 comments on commit 7e79f78

Please sign in to comment.