Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177421056
D61356.1794340283.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61356.1794340283.diff
View Options
diff --git a/sbin/nvmecontrol/format.c b/sbin/nvmecontrol/format.c
--- a/sbin/nvmecontrol/format.c
+++ b/sbin/nvmecontrol/format.c
@@ -190,7 +190,7 @@
struct nvme_pt_command pt;
char *path;
const char *target;
- uint32_t cdw10, nsid, scan_nsid;
+ uint32_t nsid, scan_nsid;
int lbaf, ms, pi, pil, ses, fd;
u_int i;
uint32_t sector_size;
@@ -312,6 +312,8 @@
}
if (lbaf < 0)
lbaf = 0;
+ else if (lbaf > 63)
+ errx(EX_USAGE, "LBA format is out of range");
if (ms < 0)
ms = 0;
if (pi < 0)
@@ -320,20 +322,17 @@
pil = 0;
}
- cdw10 = (ses << 9) + (pil << 8) + (pi << 5) + (ms << 4) + lbaf;
+ memset(&pt, 0, sizeof(pt));
+ nvme_admin_format_cmd(&pt.cmd, nsid, ses, pil, pi, ms, lbaf);
if (opt.dry_run) {
printf("Format NVM: opc=%#x nsid=%#010x cdw10=%#010x "
"(lbaf=%d mset=%d pi=%d pil=%d ses=%d)\n",
- NVME_OPC_FORMAT_NVM, nsid, cdw10, lbaf, ms, pi, pil, ses);
+ NVME_OPC_FORMAT_NVM, nsid, le32toh(pt.cmd.cdw10), lbaf,
+ ms, pi, pil, ses);
close(fd);
exit(0);
}
- memset(&pt, 0, sizeof(pt));
- pt.cmd.opc = NVME_OPC_FORMAT_NVM;
- pt.cmd.nsid = htole32(nsid);
- pt.cmd.cdw10 = htole32(cdw10);
-
if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
err(EX_IOERR, "format request failed");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 10, 7:51 PM (12 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41645671
Default Alt Text
D61356.1794340283.diff (1 KB)
Attached To
Mode
D61356: nvmecontrol: Mask the fields in the Format NVM command
Attached
Detach File
Event Timeline