]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: Fixed segmentation fault when getting host initiated telemetry
authorda Cunha, Leonardo <leonardo.da.cunha@solidigm.com>
Wed, 11 Oct 2023 16:01:44 +0000 (09:01 -0700)
committerDaniel Wagner <wagi@monom.org>
Thu, 12 Oct 2023 06:22:02 +0000 (08:22 +0200)
Signed-off-by: leonardo.da.cunha <leonardo.da.cunha@solidigm.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index b9e56a48f0a59e4496ca26362bde501f59b00c71..73d74afdfd73e70f8b3de8b48e4154bbd70cf2c1 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -851,6 +851,10 @@ static int __get_telemetry_log_host(struct nvme_dev *dev,
        _cleanup_free_ struct nvme_telemetry_log *log = NULL;
        int err;
 
+       log = nvme_alloc(sizeof(*log));
+       if (!log)
+               return -errno;
+
        err = nvme_cli_get_log_telemetry_host(dev, 0,
                                              NVME_LOG_TELEM_BLOCK_SIZE,
                                              log);