Blame SOURCES/0091-cxl-json-Cleanup-object-leak-false-positive.patch

e0018b
From 8f457dc414ec27178828c86533910958542ce73d Mon Sep 17 00:00:00 2001
e0018b
From: Dan Williams <dan.j.williams@intel.com>
e0018b
Date: Sun, 23 Jan 2022 16:52:15 -0800
e0018b
Subject: [PATCH 091/217] cxl/json: Cleanup object leak false positive
e0018b
e0018b
As written it is a leak of the json object to return if devname is NULL.
e0018b
However, the devname can not be NULL because the memdev would not have been
e0018b
enumerated. Drop the error checking.
e0018b
e0018b
Link: https://lore.kernel.org/r/164298553566.3021641.11858634436119663877.stgit@dwillia2-desk3.amr.corp.intel.com
e0018b
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 cxl/json.c | 2 +-
e0018b
 1 file changed, 1 insertion(+), 1 deletion(-)
e0018b
e0018b
diff --git a/cxl/json.c b/cxl/json.c
e0018b
index 97ed76b..3ef9f76 100644
e0018b
--- a/cxl/json.c
e0018b
+++ b/cxl/json.c
e0018b
@@ -190,7 +190,7 @@ struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
e0018b
 	struct json_object *jdev, *jobj;
e0018b
 
e0018b
 	jdev = json_object_new_object();
e0018b
-	if (!devname || !jdev)
e0018b
+	if (!jdev)
e0018b
 		return NULL;
e0018b
 
e0018b
 	jobj = json_object_new_string(devname);
e0018b
-- 
e0018b
2.27.0
e0018b