Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d8f062e authored by Colin Ian King's avatar Colin Ian King Committed by Rafael J. Wysocki
Browse files

drivers: base: swnode: check if pointer p is NULL before dereferencing it



The pointer p can be potentially NULL as macro to_software_node can
return NULL.

Add null check on p before dereferencing it to avoid any NULL pointer
dereferences.

Detected by CoverityScan, CID#1476039 ("Explicit null dereferenced")

Fixes: 59abd836 (drivers: base: Introducing software nodes to the firmware node framework)
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent d8924c0d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -487,7 +487,7 @@ software_node_get_next_child(const struct fwnode_handle *fwnode,
	struct software_node *p = to_software_node(fwnode);
	struct software_node *p = to_software_node(fwnode);
	struct software_node *c = to_software_node(child);
	struct software_node *c = to_software_node(child);


	if (list_empty(&p->children) ||
	if (!p || list_empty(&p->children) ||
	    (c && list_is_last(&c->entry, &p->children)))
	    (c && list_is_last(&c->entry, &p->children)))
		return NULL;
		return NULL;