]> 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)
commit1f486c243c0443ef161d7306685484f31a09edf1
tree4e16a6fd0279620ac8960893abe7d72901a4c165
parent65105dae2bc072612466826d9410ddf9a6b79e0d
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: f03986c58ac2 ("nvme-pci: implement host memory buffer support")
drivers/nvme/host/pci.c