From 532c85a3f6bb8565ef6ed0350fc94d05888e12ac Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Tue, 28 Apr 2026 00:06:50 +0900 Subject: [PATCH] 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 --- nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvme.c b/nvme.c index 4e44aba838..5cb0c8dd31 100644 --- a/nvme.c +++ b/nvme.c @@ -7865,7 +7865,7 @@ static int copy_cmd(int argc, char **argv, struct command *acmd, struct plugin * nats = argconfig_parse_comma_sep_array_u16(cfg.elbats, elbats, ARRAY_SIZE(elbats)); - nr = max(nb, max(ns, max(nrts, max(natms, nats)))); + nr = max(nb, max(ns, max(nrts, max(natms, nats)))) - 1; if (cfg.format == 2 || cfg.format == 3) { if (nr != nids) { 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 * nvme_show_error("formats 0 and 1 do not support cross-namespace copy"); return -EINVAL; } - if (!nr || nr > 256) { + if (nr > 255) { nvme_show_error("invalid range"); return -EINVAL; }