mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
usb: storage: Fix overwritten in usb_stor_set_max_xfer_blk()
The stored 'blk' value is overwritten to 'size / 512' before it can be used in usb_stor_set_max_xfer_blk(). This is not what we want. In fact, when 'size' exceeds the upper limit (USHRT_MAX * 512), we should simply assign 'size' to the upper limit. Reported-by: Coverity (CID: 167250) Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
fae35857e1
commit
72ac8f3fc2
1 changed files with 1 additions and 1 deletions
|
@ -964,7 +964,7 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
|
|||
blk = 20;
|
||||
} else {
|
||||
if (size > USHRT_MAX * 512)
|
||||
blk = USHRT_MAX;
|
||||
size = USHRT_MAX * 512;
|
||||
blk = size / 512;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue