From: Steven Seungcheol Lee Date: Mon, 13 Mar 2023 05:55:04 +0000 (+0900) Subject: fdp: Fix wrong Reclaim Unit Handle Status size X-Git-Tag: v2.4~35 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=dd8cf2d4f19cf0c9a0bfc888480108abb05e25e3;p=users%2Fsagi%2Fnvme-cli.git fdp: Fix wrong Reclaim Unit Handle Status size size should include reserved, NRUHSD bytes that exist before Reclaim Unit Handle Status Descriptor List Signed-off-by: Steven Seungcheol Lee --- diff --git a/plugins/fdp/fdp.c b/plugins/fdp/fdp.c index 9fef2710..1e292e8c 100644 --- a/plugins/fdp/fdp.c +++ b/plugins/fdp/fdp.c @@ -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;