anitazha / rpms / ndctl

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