]> 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)
commit4a0b28f25cb9b78f04a006010cf8dc383c09a78b
tree4e16a6fd0279620ac8960893abe7d72901a4c165
parenteaff3eab763a0efe102951a131aba9d84065dd49
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: 110ce3c2ba74 ("nvme-pci: implement host memory buffer support")
drivers/nvme/host/pci.c