1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-28 16:43:09 +00:00

Explicitly set reserved fields and 'fuse' to 0. This prevents us from

acidentally sending bogus values in these fields, which some drives
may reject with an error or worse (undefined behavior).

This is especially needed for the ndadump routine which allocates the
cmd from stack garbage....

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-10-15 16:17:59 +00:00
parent 717bff5d85
commit fbed8df259
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324631

View File

@ -1082,7 +1082,11 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t rwcmd, uint32_t nsid,
uint64_t lba, uint32_t count)
{
cmd->opc = rwcmd;
cmd->fuse = 0;
cmd->rsvd1 = 0;
cmd->nsid = nsid;
cmd->rsvd2 = 0;
cmd->rsvd3 = 0;
cmd->cdw10 = lba & 0xffffffffu;
cmd->cdw11 = lba >> 32;
cmd->cdw12 = count-1;