From: Martin George Date: Tue, 7 Mar 2023 11:09:54 +0000 (+0530) Subject: nvme-print: fix segfault in supported-log-pages json output X-Git-Tag: v2.4~42 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d3e0876104abe3a1fd540d8e9ed7d8ec912eee85;p=users%2Fsagi%2Fnvme-cli.git 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 --- 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]);