Date: Sun, 15 Oct 2017 16:17:59 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324631 - head/sys/dev/nvme Message-ID: <201710151617.v9FGHxA2095914@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Sun Oct 15 16:17:59 2017 New Revision: 324631 URL: https://svnweb.freebsd.org/changeset/base/324631 Log: 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 Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sun Oct 15 16:17:55 2017 (r324630) +++ head/sys/dev/nvme/nvme.h Sun Oct 15 16:17:59 2017 (r324631) @@ -1082,7 +1082,11 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710151617.v9FGHxA2095914>