]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
zns: for zra report zone make sure data len is set
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Wed, 31 Mar 2021 02:03:39 +0000 (19:03 -0700)
committerKeith Busch <kbusch@kernel.org>
Thu, 8 Apr 2021 00:59:11 +0000 (09:59 +0900)
Make sure for the Zone Receive Action data length is set by the user.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
plugins/zns/zns.c

index 75caa5c1a52f8ed4e028eb49c3f39bf2378f49fc..7f6f52e23bd97a7979659474bb290a7c058de1db 100644 (file)
@@ -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) {