Skip to contentSkip to conversation

software nodes: Fix use of potentially uninitialized variable

PATCH Applied Heikki Krogerus 3 participants 7 messages Aug 30, 2019 – Sep 4, 2019

Subsystems (2)
lore
Share & tools
lore

Heikki Krogerus

author reviewer
#0 lore raw

v3 cover software nodes: Fix use of potentially uninitialized variable

Hi,

The patches now have a bit better commit messages (hopefully).

Rafael should take these since the patches that these fix are in his tree.

thanks,

Heikki Krogerus (2):
software node: Initialize the return value in
software_node_to_swnode()
software node: Initialize the return value in
software_node_find_by_name()

 drivers/base/swnode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.23.0.rc1
author reviewer
#1 lore raw

PATCH v3 1/2 software node: Initialize the return value in software_node_to_swnode()

The software node is searched from a list that may be empty when the function is called. This makes sure that the function returns NULL even if the list is empty.

Fixes 80488a6b1d3c ("software node: Add support for static node descriptors")
---
 drivers/base/swnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/swnode.c +1 -1
index 024d3f54a8d6..82dd69d72a64 100644
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(is_software_node);
 static struct swnode *
 software_node_to_swnode(const struct software_node *node)
 {
-	struct swnode *swnode;
+	struct swnode *swnode = NULL;
 	struct kobject *k;
 
 	if (!node)
Signature · 1 line
2.23.0.rc1
maintainer Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] software node: Initialize the return value in software_node_to_swnode()

Quoted 8 lines · Heikki Krogerus

The software node is searched from a list that may be empty when the function is called. This makes sure that the function returns NULL even if the list is empty.

Fixes 80488a6b1d3c ("software node: Add support for static node descriptors")
maintainer Applied
#3 lore raw

Re: [PATCH v3 1/2] software node: Initialize the return value in software_node_to_swnode()

Quoted 6 lines · Greg Kroah-Hartman
Quoted 4 lines · Heikki Krogerus

The software node is searched from a list that may be empty when the function is called. This makes sure that the function returns NULL even if the list is empty.

Quoted 6 lines
Quoted 4 lines
Fixes 80488a6b1d3c ("software node: Add support for static node descriptors")

Applied, thanks!

author reviewer
#4 lore raw

PATCH v3 2/2 software node: Initialize the return value in software_node_find_by_name()

In reply to Heikki Krogerus

The software node is searched from a list that may be empty when the function is called. This makes sure that the function returns NULL if the list is empty.

Fixes 1666faedb567 ("software node: Add software_node_get_reference_args()")
---
 drivers/base/swnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/swnode.c +1 -1
index 82dd69d72a64..3566079fa87d 100644
@@ -722,7 +722,7 @@ static const struct fwnode_operations software_node_ops = {
 const struct software_node *
 software_node_find_by_name(const struct software_node *parent, const char *name)
 {
-	struct swnode *swnode;
+	struct swnode *swnode = NULL;
 	struct kobject *k;
 
 	if (!name)
Signature · 1 line
2.23.0.rc1
maintainer Reviewed-by on v3 2/2
#5 lore raw

Re: [PATCH v3 2/2] software node: Initialize the return value in software_node_find_by_name()

Quoted 8 lines · Heikki Krogerus

The software node is searched from a list that may be empty when the function is called. This makes sure that the function returns NULL if the list is empty.

Fixes 1666faedb567 ("software node: Add software_node_get_reference_args()")
maintainer Applied
#6 lore raw

Re: [PATCH v3 2/2] software node: Initialize the return value in software_node_find_by_name()

Quoted 6 lines · Greg Kroah-Hartman
Quoted 4 lines · Heikki Krogerus

The software node is searched from a list that may be empty when the function is called. This makes sure that the function returns NULL if the list is empty.

Quoted 6 lines
Quoted 4 lines
Fixes 1666faedb567 ("software node: Add software_node_get_reference_args()")

Applied, thanks!