]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
nvme-print: fix namespace descriptor human printing
authorKlaus Jensen <k.jensen@samsung.com>
Mon, 6 Apr 2020 07:06:36 +0000 (09:06 +0200)
committerKeith Busch <kbusch@kernel.org>
Tue, 14 Apr 2020 17:08:07 +0000 (11:08 -0600)
9b2ce6ca3ba7 fixed the len accumulation, but only for the JSON printing.
Fix it for human output as well.

Reported-by: Narae Park <narae7.park@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
nvme-print.c

index dc491cf6c7da92fefe8d1ae8847a46db3fe8fb76..42e27a39f24eff1b953c45712de8516d37da2b36 100644 (file)
@@ -2622,7 +2622,7 @@ void nvme_show_id_ns_descs(void *data, unsigned nsid, enum nvme_print_flags flag
                        for (i = 0; i < 8; i++)
                                printf("%02x", eui64[i]);
                        printf("\n");
-                       len += sizeof(eui64);
+                       len = sizeof(eui64);
                        break;
                case NVME_NIDT_NGUID:
                        memcpy(nguid, data + pos + sizeof(*cur), sizeof(nguid));
@@ -2630,14 +2630,14 @@ void nvme_show_id_ns_descs(void *data, unsigned nsid, enum nvme_print_flags flag
                        for (i = 0; i < 16; i++)
                                printf("%02x", nguid[i]);
                        printf("\n");
-                       len += sizeof(nguid);
+                       len = sizeof(nguid);
                        break;
 #ifdef LIBUUID
                case NVME_NIDT_UUID:
                        memcpy(uuid, data + pos + sizeof(*cur), 16);
                        uuid_unparse_lower(uuid, uuid_str);
                        printf("uuid    : %s\n", uuid_str);
-                       len += sizeof(uuid);
+                       len = sizeof(uuid);
                        break;
 #endif
                default: