Skip to contentSkip to conversation

nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()

PATCH New Eyal BenDavid 2 participants 5 messages Jun 24, 2018 – Jun 27, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()

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:

nvme-ioctl.c +3 -1
index 63ff8fb..d52dd0a 100644
@@ -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);
        }
#1 lore raw

PATCH 1/1 nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()

In case it was missed.
Thanks

---------- Forwarded message ---------
From: Eyal BenDavid <[email protected]>
Date: Sun, Jun 24, 2018 at 10:37 AM
Subject: [PATCH] nvme-cli : fix offset advance in nvme-ioctl.c:
nvme_get_properties()
To: linux-nvme <linux-nvme at lists.infradead.org>

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:

nvme-ioctl.c +3 -1
index 63ff8fb..d52dd0a 100644
@@ -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);
        }
#2 lore raw

PATCH 1/1 nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()

Quoted 2 lines · Eyal BenDavid

In case it was missed.
Thanks

It looks like your email client damaged your patch, turning all the tabs to spaces. This won't apply as-is. Could you possibly resend, or send a github pull request?

Quoted 36 lines

---------- Forwarded message ---------
From: Eyal BenDavid <bdeyal at gmail.com>
Date: Sun, Jun 24, 2018 at 10:37 AM
Subject: [PATCH] nvme-cli : fix offset advance in nvme-ioctl.c:
nvme_get_properties()
To: linux-nvme <linux-nvme at lists.infradead.org>

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:

nvme-ioctl.c +3 -1
index 63ff8fb..d52dd0a 100644
@@ -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);
        }

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw

PATCH 1/1 nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()

Resend:

nvme-ioctl.c +3 -1
index f1c7ce6..2e0abf9 100644
@@ -578,8 +578,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);
        }
Quoted 46 lines · Keith Busch
Quoted 2 lines · Eyal BenDavid

In case it was missed.
Thanks

It looks like your email client damaged your patch, turning all the tabs to spaces. This won't apply as-is. Could you possibly resend, or send a github pull request?

Quoted 36 lines

---------- Forwarded message ---------
From: Eyal BenDavid <bdeyal at gmail.com>
Date: Sun, Jun 24, 2018 at 10:37 AM
Subject: [PATCH] nvme-cli : fix offset advance in nvme-ioctl.c:
nvme_get_properties()
To: linux-nvme <linux-nvme at lists.infradead.org>

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:

nvme-ioctl.c +3 -1
index 63ff8fb..d52dd0a 100644
@@ -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);
        }

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#4 lore raw

PATCH 1/1 nvme-cli : fix offset advance in nvme-ioctl.c: nvme_get_properties()

Quoted 8 lines · Eyal BenDavid

Resend:

nvme-ioctl.c +0 -0
index f1c7ce6..2e0abf9 100644
@@ -578,8 +578,10 @@ int nvme_get_properties(int fd, void **pbar)
                        continue;

nvme-ioctl.c int nvme_get_properties(int fd, void **pbar) · line 587

Quoted 10 lines
nvme-ioctl.c +3 -1
                }
                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);
        }

The diff is still mangled and doesn't apply.