]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: avoid sending uninitialized timestamp
authorCaleb Sander <csander@purestorage.com>
Fri, 8 Sep 2023 19:47:16 +0000 (13:47 -0600)
committerDaniel Wagner <wagi@monom.org>
Wed, 20 Sep 2023 08:33:57 +0000 (10:33 +0200)
The last 2 bytes of the struct nvme_timestamp data
are not initialized in nvme_set_features_timestamp().
Add an initializer to avoid sending uninitialized stack memory
to the controller.

Signed-off-by: Caleb Sander <csander@purestorage.com>
src/nvme/ioctl.c

index d2b672d2b6212d61502648039d1ffce4d50caf16..39899c21d67d5a655dfa52c84fb61bfdd20a65c2 100644 (file)
@@ -685,7 +685,7 @@ int nvme_set_features_auto_pst(int fd, bool apste, bool save,
 int nvme_set_features_timestamp(int fd, bool save, __u64 timestamp)
 {
        __le64 t = cpu_to_le64(timestamp);
-       struct nvme_timestamp ts;
+       struct nvme_timestamp ts = {};
        struct nvme_set_features_args args = {
                .args_size = sizeof(args),
                .fd = fd,