]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print: fix counter while looping through uuid_list
authorMartin George <marting@netapp.com>
Wed, 19 Jul 2023 06:55:54 +0000 (12:25 +0530)
committerDaniel Wagner <wagi@monom.org>
Thu, 20 Jul 2023 08:14:30 +0000 (10:14 +0200)
While iterating through the uuid_list in json_nvme_id_uuid_list()
as part of the 'id-uuid' json output, it always misses out
displaying the first uuid entry here due to wrongly initialized
counter value. Fix it.

And while we are at it, remove the respective comment in
stdout_id_uuid_list() as well where this counter is already
properly initiatlized.

Signed-off-by: Martin George <marting@netapp.com>
nvme-print-json.c
nvme-print-stdout.c

index 923b28ecf53a9c1bfac520a96f8014b3408e6508..870f7c5c4c090f2cc9b1bf376b7d292bfef3be0c 100644 (file)
@@ -2378,8 +2378,8 @@ static void json_nvme_id_uuid_list(const struct nvme_id_uuid_list *uuid_list)
 
        root = json_create_object();
        entries = json_create_array();
-       /* The 0th entry is reserved */
-       for (i = 1; i < NVME_ID_UUID_LIST_MAX; i++) {
+
+       for (i = 0; i < NVME_ID_UUID_LIST_MAX; i++) {
                __u8 uuid[NVME_UUID_LEN];
                struct json_object *entry = json_create_object();
 
index 877ba75144885e3dafc927b1ded4a0d29b990fa3..63711c3493812897065e4c9f5a5195d1fa5e8dec 100644 (file)
@@ -3207,8 +3207,8 @@ static void stdout_id_uuid_list(const struct nvme_id_uuid_list *uuid_list)
 {
        int i, human = stdout_print_ops.flags & VERBOSE;
 
-       /* The 0th entry is reserved */
        printf("NVME Identify UUID:\n");
+
        for (i = 0; i < NVME_ID_UUID_LIST_MAX; i++) {
                __u8 uuid[NVME_UUID_LEN];
                char *association = "";