]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: Set file descriptor in nvme_get_log_page()
authorDaniel Wagner <dwagner@suse.de>
Wed, 15 Feb 2023 11:16:03 +0000 (12:16 +0100)
committerDaniel Wagner <wagi@monom.org>
Thu, 16 Feb 2023 07:32:00 +0000 (08:32 +0100)
We explicitly ask for a file descriptor in the API so use it. The caller
might not have set it in args.

For example, in nvme-cli when the libnvme wrappers are used to hide the
transport details from the nvme-cli core, the macros only pass the file
descriptor via the function arguments but don't set it in the arg
structs.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
src/nvme/ioctl.c

index b2d92efd930303951af147918cd7a2d7854ac025..2b5e09ddb3ca2cec7f8d32b605022196ca99a86c 100644 (file)
@@ -438,6 +438,8 @@ int nvme_get_log_page(int fd, __u32 xfer_len, struct nvme_get_log_args *args)
        void *ptr = args->log;
        int ret;
 
+       args->fd = fd;
+
        /*
         * 4k is the smallest possible transfer unit, so restricting to 4k
         * avoids having to check the MDTS value of the controller.