]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet: avoid integer overflow in the discard code
authorBart Van Assche <bvanassche@acm.org>
Mon, 8 Oct 2018 21:28:52 +0000 (14:28 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 17 Oct 2018 06:58:27 +0000 (08:58 +0200)
commit08969f6f3da061e6bef9fed3d7eab716e79c1fa4
tree135e3d5ab85f31659294bbaab1290e638e149bab
parente35d252dc20ab569dc27736d96e65f1a732c14f9
nvmet: avoid integer overflow in the discard code

Although I'm not sure whether it is a good idea to support large discard
commands, I think integer overflow for discard ranges larger than 4 GB
should be avoided. This patch avoids that smatch reports the following:

drivers/nvme/target/io-cmd-file.c:249:1 nvmet_file_execute_discard() warn: should '((range.nlb)) << req->ns->blksize_shift' be a 64 bit type?

Fixes: af57dd9ccb9c ("nvmet: add simple file backed ns support")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/io-cmd-file.c