]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-pci: fix HMB size calculation
authorChristoph Hellwig <hch@lst.de>
Tue, 25 Jul 2017 15:39:07 +0000 (17:39 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 25 Jul 2017 16:05:33 +0000 (18:05 +0200)
commit50cdb7c61b019a732fe34635a7cbf2a7487f5e90
tree4e16a6fd0279620ac8960893abe7d72901a4c165
parent9c5358e15ca12ed3dc3b1e51671dee5d155de8e0
nvme-pci: fix HMB size calculation

It's possible the preferred HMB size may not be a multiple of the
chunk_size. This patch moves len to function scope and uses that in
the for loop increment so the last iteration doesn't cause the total
size to exceed the allocated HMB size.

Based on an earlier patch from Keith Busch.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Fixes: 87ad72a59a38 ("nvme-pci: implement host memory buffer support")
drivers/nvme/host/pci.c