summaryrefslogtreecommitdiff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorJan H. Schönherr <jschoenh@amazon.de>2017-08-27 16:56:37 +0300
committerSagi Grimberg <sagi@grimberg.me>2017-08-28 23:00:44 +0300
commit5228b3280b9bb8fa6aef59f891cca64a028e9b36 (patch)
tree28be145a848ae793071ac7b8800dc6cb36eb353c /drivers/nvme
parenta7b7c7a105a528e6c2a0a2581b814a5acacb4c38 (diff)
downloadlinux-5228b3280b9bb8fa6aef59f891cca64a028e9b36.tar.xz
nvme: fix uninitialized prp2 value on small transfers
The value of iod->first_dma ends up as prp2 in NVMe commands. In case there is not enough data to cross a page boundary, iod->first_dma is never initialized and contains random data. Comply with the NVMe specification and fill in 0 in that case. Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/pci.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index e6283745ecd2..544805a2421b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -555,8 +555,10 @@ static blk_status_t nvme_setup_prps(struct nvme_dev *dev, struct request *req)
int nprps, i;
length -= (page_size - offset);
- if (length <= 0)
+ if (length <= 0) {
+ iod->first_dma = 0;
return BLK_STS_OK;
+ }
dma_len -= (page_size - offset);
if (dma_len) {