Skip to content

Commit 532c85a

Browse files
committed
nvme: fix copy command nr value as zero based
Since it was set the maximum value of argconfig_parse_comma_sep_array_u**. But those values are not zero based then fix to set with minus 1. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent 79bb406 commit 532c85a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

nvme.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7865,7 +7865,7 @@ static int copy_cmd(int argc, char **argv, struct command *acmd, struct plugin *
78657865
nats = argconfig_parse_comma_sep_array_u16(cfg.elbats, elbats,
78667866
ARRAY_SIZE(elbats));
78677867

7868-
nr = max(nb, max(ns, max(nrts, max(natms, nats))));
7868+
nr = max(nb, max(ns, max(nrts, max(natms, nats)))) - 1;
78697869
if (cfg.format == 2 || cfg.format == 3) {
78707870
if (nr != nids) {
78717871
nvme_show_error("formats 2 and 3 require source namespace ids for each source range");
@@ -7875,7 +7875,7 @@ static int copy_cmd(int argc, char **argv, struct command *acmd, struct plugin *
78757875
nvme_show_error("formats 0 and 1 do not support cross-namespace copy");
78767876
return -EINVAL;
78777877
}
7878-
if (!nr || nr > 256) {
7878+
if (nr > 255) {
78797879
nvme_show_error("invalid range");
78807880
return -EINVAL;
78817881
}

0 commit comments

Comments
 (0)