Skip to content

Commit d3c87bf

Browse files
committed
nvme: make --opcode argument mandatory
The shorthand -o change for --output from --opcode before. Then the default opcode value zero used incorrectly if the -o used. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 2b2cbf7 commit d3c87bf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

nvme.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9123,6 +9123,11 @@ static int passthru(int argc, char **argv, bool admin,
91239123
return err;
91249124
}
91259125

9126+
if (!argconfig_parse_seen(opts, "opcode")) {
9127+
nvme_show_error("%s: opcode parameter required", cmd->name);
9128+
return -EINVAL;
9129+
}
9130+
91269131
if (cfg.opcode & 0x01) {
91279132
cfg.write = true;
91289133
flags = O_RDONLY;
@@ -10186,6 +10191,11 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc)
1018610191
if (err)
1018710192
return err;
1018810193

10194+
if (!argconfig_parse_seen(opts, "opcode")) {
10195+
nvme_show_error("%s: opcode parameter required", *argv);
10196+
return -EINVAL;
10197+
}
10198+
1018910199
if (admin_opcode == nvme_admin_nvme_mi_send) {
1019010200
flags = O_RDONLY;
1019110201
fd = STDIN_FILENO;

0 commit comments

Comments
 (0)