From 08dec87f7b2fa2d07fbbf9be98ae50671852a7e0 Mon Sep 17 00:00:00 2001 From: Martin George Date: Wed, 19 Jul 2023 12:25:54 +0530 Subject: [PATCH] nvme-print: fix counter while looping through uuid_list 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 --- nvme-print-json.c | 4 ++-- nvme-print-stdout.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nvme-print-json.c b/nvme-print-json.c index 923b28ec..870f7c5c 100644 --- a/nvme-print-json.c +++ b/nvme-print-json.c @@ -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(); diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 877ba751..63711c34 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -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 = ""; -- 2.50.1