[Accel-config] [PATCH v1 1/5] accel-config: static analysis bug fix

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

group is checked for null but code continues if null. This triggers
2 issues - group and dev can be dereferenced even if null. Removing
the check because the function is called only if group is not null.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/list.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/accfg/list.c b/accfg/list.c
index c22da41..2234e65 100644
--- a/accfg/list.c
+++ b/accfg/list.c
@@ -56,8 +56,7 @@ static struct json_object *group_to_json(struct accfg_group *group,
 	struct json_object *jobj = NULL;
 	struct accfg_device *dev = NULL;
 
-	if (group)
-		dev = accfg_group_get_device(group);
+	dev = accfg_group_get_device(group);
 
 	if (!jgroup)
 		return NULL;
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.