]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/solidigm: Telemetry null check json object
authorhsdhillo <Hardeep.Dhillon@solidigm.com>
Thu, 2 Jan 2025 19:02:17 +0000 (11:02 -0800)
committerDaniel Wagner <wagi@monom.org>
Thu, 30 Jan 2025 08:07:04 +0000 (09:07 +0100)
ensure object is not null

Signed-off-by: hsdhillo <Hardeep.Dhillon@solidigm.com>
plugins/solidigm/solidigm-telemetry/config.c

index eceeede5d276b05459ccc4d3dd76b94b35ccaf25..9d1b4e2ae35ea13afcf802308ab2b4883c2f0e1a 100644 (file)
@@ -61,7 +61,7 @@ const char *solidigm_config_get_nlog_obj_name(const struct json_object *config,
        if (!json_object_object_get_ex(nlog_names, hex_header, &obj_name))
                return NULL;
        name = json_object_get_string(obj_name);
-       if (strncmp(NLOG_OBJ_PREFIX, name, strlen(NLOG_OBJ_PREFIX)))
+       if ((!name) || (strncmp(NLOG_OBJ_PREFIX, name, strlen(NLOG_OBJ_PREFIX))))
                return NULL;
 
        return &name[strlen(OBJ_NAME_PREFIX)];