From d3e0876104abe3a1fd540d8e9ed7d8ec912eee85 Mon Sep 17 00:00:00 2001 From: Martin George Date: Tue, 7 Mar 2023 16:39:54 +0530 Subject: [PATCH] nvme-print: fix segfault in supported-log-pages json output nvme supported-log-pages -o json currently segfaults due to the wrong json object type as shown below: nvme: json_object.c: json_object_array_add: Assertion `json_object_get_type(jso) == json_type_array' failed. Aborted (core dumped) Fix this by passing the appropriate json type. Signed-off-by: Martin George --- nvme-print-json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvme-print-json.c b/nvme-print-json.c index 176c5557..40dbb2f8 100644 --- a/nvme-print-json.c +++ b/nvme-print-json.c @@ -2441,7 +2441,7 @@ void json_support_log(struct nvme_supported_log_pages *support_log) __u32 support; root = json_create_object(); - valid = json_create_object(); + valid = json_create_array(); for (lid = 0; lid < 256; lid++) { support = le32_to_cpu(support_log->lid_support[lid]); -- 2.50.1