mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
Staging: rts_pstor: fix read past end of buffer
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>
This commit is contained in:
parent
581de3b0a5
commit
7e79f78b33
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
log_blk = (u16)(start_sector >> ms_card->block_shift);
|
||||||
start_page = (u8)(start_sector & ms_card->page_off);
|
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])
|
if (log_blk < ms_start_idx[seg_no+1])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue