Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()
@ 2018-06-24  7:37 Eyal BenDavid
  2018-06-27 17:34 ` Fwd: " Eyal BenDavid
  0 siblings, 1 reply; 5+ messages in thread
From: Eyal BenDavid @ 2018-06-24  7:37 UTC (permalink / raw)


In the case of 64 bit property, the offset loop variable is advanced
correctly only on error. When the call to nvme_property is successful
(and thus err == 0) the offset variable is advanced by 4 bytes only.

Here is a small patch that fixes the offset:

diff --git i/nvme-ioctl.c w/nvme-ioctl.c
index 63ff8fb..d52dd0a 100644
--- i/nvme-ioctl.c
+++ w/nvme-ioctl.c
@@ -572,8 +572,10 @@ int nvme_get_properties(int fd, void **pbar)
                        continue;
                }
                ret = 0;
-               if (is64bit)
+             if (is64bit) {
                        *(uint64_t *)(*pbar + off) = le64_to_cpu(value64);
+                       off += 4;
+               }

                else
                        *(uint32_t *)(*pbar + off) = le32_to_cpu(value64);
        }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-27 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-24  7:37 [PATCH] nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties() Eyal BenDavid
2018-06-27 17:34 ` Fwd: " Eyal BenDavid
2018-06-27 17:42   ` Keith Busch
2018-06-27 17:57     ` Eyal BenDavid
2018-06-27 18:08       ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox