Skip to content

Commit 922937b

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 5ced5c0 commit 922937b

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
@@ -9125,6 +9125,11 @@ static int passthru(int argc, char **argv, bool admin,
91259125
return err;
91269126
}
91279127

9128+
if (!argconfig_parse_seen(opts, "opcode")) {
9129+
nvme_show_error("%s: opcode parameter required", cmd->name);
9130+
return -EINVAL;
9131+
}
9132+
91289133
if (cfg.opcode & 0x01) {
91299134
cfg.write = true;
91309135
flags = O_RDONLY;
@@ -10188,6 +10193,11 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc)
1018810193
if (err)
1018910194
return err;
1019010195

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

0 commit comments

Comments
 (0)