]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fdp: Fix wrong Reclaim Unit Handle Status size
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Mon, 13 Mar 2023 05:55:04 +0000 (14:55 +0900)
committerDaniel Wagner <wagi@monom.org>
Wed, 15 Mar 2023 07:30:02 +0000 (08:30 +0100)
size should include reserved, NRUHSD bytes
that exist before Reclaim Unit Handle Status Descriptor List

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
plugins/fdp/fdp.c

index 9fef27108aac1cc0aec031c3852b017350ac3ff1..1e292e8cfaa881e6a3075f276bb484d59e528940 100644 (file)
@@ -350,7 +350,8 @@ static int fdp_status(int argc, char **argv, struct command *cmd, struct plugin
                goto out;
        }
 
-       len = le16_to_cpu(hdr.nruhsd) * sizeof(struct nvme_fdp_ruh_status_desc);
+       len = sizeof(struct nvme_fdp_ruh_status) +
+               le16_to_cpu(hdr.nruhsd) * sizeof(struct nvme_fdp_ruh_status_desc);
        buf = malloc(len);
        if (!buf) {
                err = -ENOMEM;