diff options
author | Keith Busch <keith.busch@intel.com> | 2014-03-24 10:03:56 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2014-03-24 10:03:56 -0400 |
commit | ddcb776286c091189a7b928188112470ec7e9efc (patch) | |
tree | 077548a5b838e231dc10783079ccf2360b072a04 /drivers/block | |
parent | 4f5099af4f3d5f999d8ab7784472d93e810e3912 (diff) |
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 <mundu2510@gmail.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/nvme-scsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c index e157e85bb5d7..111c920c1574 100644 --- a/drivers/block/nvme-scsi.c +++ b/drivers/block/nvme-scsi.c | |||
@@ -2044,7 +2044,7 @@ static int nvme_trans_do_nvme_io(struct nvme_ns *ns, struct sg_io_hdr *hdr, | |||
2044 | struct nvme_command c; | 2044 | struct nvme_command c; |
2045 | u8 opcode = (is_write ? nvme_cmd_write : nvme_cmd_read); | 2045 | u8 opcode = (is_write ? nvme_cmd_write : nvme_cmd_read); |
2046 | u16 control; | 2046 | u16 control; |
2047 | u32 max_blocks = nvme_block_nr(ns, dev->max_hw_sectors); | 2047 | u32 max_blocks = queue_max_hw_sectors(ns->queue); |
2048 | 2048 | ||
2049 | num_cmds = nvme_trans_io_get_num_cmds(hdr, cdb_info, max_blocks); | 2049 | num_cmds = nvme_trans_io_get_num_cmds(hdr, cdb_info, max_blocks); |
2050 | 2050 | ||