mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
NVMe: Fix divide-by-zero in nvme_trans_io_get_num_cmds
dev->max_hw_sectors may be zero to indicate the device has no limit on the number of sectors. nvme_trans_do_nvme_io() should use the software limit, since this is guaranteed to be non-zero. Reported-by: Mundu <[email protected]> Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Matthew Wilcox <[email protected]>
This commit is contained in:
parent
4f5099af4f
commit
ddcb776286
1 changed files with 1 additions and 1 deletions
|
|
@ -2044,7 +2044,7 @@ static int nvme_trans_do_nvme_io(struct nvme_ns *ns, struct sg_io_hdr *hdr,
|
|||
struct nvme_command c;
|
||||
u8 opcode = (is_write ? nvme_cmd_write : nvme_cmd_read);
|
||||
u16 control;
|
||||
u32 max_blocks = nvme_block_nr(ns, dev->max_hw_sectors);
|
||||
u32 max_blocks = queue_max_hw_sectors(ns->queue);
|
||||
|
||||
num_cmds = nvme_trans_io_get_num_cmds(hdr, cdb_info, max_blocks);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue