usb: rockusb: Forbid data beyond 32MB reading

Simply return magic char if one is trying to read data beyond 32MB.

Fixes: 628c827 ("usb: rockusb: forbid reading data beyond addr 32MB")

Change-Id: If2cdf05dbf9d6dcdd4cf8f9605ab84480fbca32d
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
This commit is contained in:
Shunqian Zheng 2019-03-14 15:08:22 +08:00 committed by Jianhong Chen
parent 7aec704a4e
commit 957c1cf2af
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ static int rkusb_read_sector(struct ums *ums_dev,
struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
if (blkstart > RKUSB_READ_LIMIT_ADDR) {
if ((blkstart + blkcnt) > RKUSB_READ_LIMIT_ADDR) {
memset(buf, 0xcc, blkcnt * SECTOR_SIZE);
return blkcnt;
} else {