[PATCH] nvme: fix uninitialized prp2 value on small transfers

Jan H. Schönherr jschoenh at amazon.de
Sun Aug 27 09:56:07 PDT 2017


On 08/27/2017 06:00 PM, Christoph Hellwig wrote:
> On Sun, Aug 27, 2017 at 03:56:37PM +0200, Jan H. Schönherr wrote:
>> 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.
>
> Zeroing it out is fine with me, but NVMe 1.3 says:
>
>    PRP Entry 2 (PRP2): This field:
> 	a) is reserved if the data transfer does not cross a memory page boundary.
>
> so I don't think the specification requires it to be zeroed.

And under "1.5 Conventions" it says:

    Hardware shall return ‘0’ for all bits and registers that are marked as reserved,
    and host software shall write all reserved bits and registers with the value of ‘0’.

> What kind of controller do you have that wants PRP2 zeroed for transfers
> that don't cross a page boundary?

This came up while doing some tracing on NVMe commands, and the random values
were a bit odd...

Regards
Jan





More information about the Linux-nvme mailing list