From bd0a1671e905916e58b5a69c7c6db7516c6af67b Mon Sep 17 00:00:00 2001 From: Chaitanya Kulkarni Date: Tue, 30 Mar 2021 19:03:39 -0700 Subject: [PATCH] zns: for zra report zone make sure data len is set Make sure for the Zone Receive Action data length is set by the user. Signed-off-by: Chaitanya Kulkarni --- plugins/zns/zns.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/zns/zns.c b/plugins/zns/zns.c index 75caa5c1..7f6f52e2 100644 --- a/plugins/zns/zns.c +++ b/plugins/zns/zns.c @@ -522,6 +522,11 @@ static int zone_mgmt_recv(int argc, char **argv, struct command *cmd, struct plu } } + if (cfg.zra == NVME_ZNS_ZRA_REPORT_ZONES && !cfg.data_len) { + fprintf(stderr, "error: data len is needed for NVME_ZRA_ZONE_REPORT\n"); + err = -EINVAL; + goto close_fd; + } if (cfg.data_len) { data = calloc(1, cfg.data_len); if (!data) { -- 2.50.1