Skip to content

Commit de0866b

Browse files
raolei-intelgregkh
authored andcommitted
nvme-pci: clear the prp2 field when not used
[ Upstream commit a56ea61 ] If the prp2 field is not filled in nvme_setup_prp_simple(), the prp2 field is garbage data. According to nvme spec, the prp2 is reserved if the data transfer does not cross a memory page boundary, so clear it to zero if it is not used. Signed-off-by: Lei Rao <lei.rao@intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8bffa95 commit de0866b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/nvme/host/pci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev,
814814
cmnd->dptr.prp1 = cpu_to_le64(iod->first_dma);
815815
if (bv->bv_len > first_prp_len)
816816
cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma + first_prp_len);
817+
else
818+
cmnd->dptr.prp2 = 0;
817819
return BLK_STS_OK;
818820
}
819821

0 commit comments

Comments
 (0)