Skip to content

Commit 5149647

Browse files
ikegami-tigaw
authored andcommitted
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 4ee204b commit 5149647

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

nvme.c

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

9122+
if (!argconfig_parse_seen(opts, "opcode")) {
9123+
nvme_show_error("%s: opcode parameter required", cmd->name);
9124+
return -EINVAL;
9125+
}
9126+
91229127
if (cfg.opcode & 0x01) {
91239128
cfg.write = true;
91249129
flags = O_RDONLY;
@@ -10182,6 +10187,11 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc)
1018210187
if (err)
1018310188
return err;
1018410189

10190+
if (!argconfig_parse_seen(opts, "opcode")) {
10191+
nvme_show_error("%s: opcode parameter required", *argv);
10192+
return -EINVAL;
10193+
}
10194+
1018510195
if (admin_opcode == nvme_admin_nvme_mi_send) {
1018610196
flags = O_RDONLY;
1018710197
fd = STDIN_FILENO;

0 commit comments

Comments
 (0)