Skip to contentSkip to conversation

x86/platform/uv: Fix an error code in uv_hubs_init()

PATCH In review Dan Carpenter 4 participants 4 messages Dec 2, 2020 – Dec 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/platform/uv: Fix an error code in uv_hubs_init()

Return -ENOMEM on allocation failure instead of returning success.

Fixes 4fc2cf1f2daf ("x86/platform/uv: Add new uv_sysfs platform driver")
---
 drivers/platform/x86/uv_sysfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/x86/uv_sysfs.c +1 -0
index 54c342579f1c..e17ce8c4cdad 100644
@@ -248,6 +248,7 @@ static int uv_hubs_init(void)
 		uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL);
 		if (!uv_hubs[i]) {
 			i--;
+			ret = -ENOMEM;
 			goto err_hubs;
 		}
 
Signature · 1 line
2.29.2
#1 lore raw
Quoted 1 line · Dan Carpenter

Return -ENOMEM on allocation failure instead of returning success.

s/success/random stack memory contents/

Signature · 4 lines
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines

Return -ENOMEM on allocation failure instead of returning success.

Fixes 4fc2cf1f2daf ("x86/platform/uv: Add new uv_sysfs platform driver")

Thank you for taking the time to find this.

(With an acknowledgement of Boris's 's/success/random stack memory contents/' comment)

Quoted 18 lines
---
 drivers/platform/x86/uv_sysfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/x86/uv_sysfs.c +1 -1
index 54c342579f1c..e17ce8c4cdad 100644
@@ -248,6 +248,7 @@ static int uv_hubs_init(void)
 		uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL);
 		if (!uv_hubs[i]) {
 			i--;
+			ret = -ENOMEM;
 			goto err_hubs;
 		}
 
--

2.29.2

Acked-by
#3 lore raw

Hi,

Quoted 9 lines · Justin
Quoted 4 lines

Return -ENOMEM on allocation failure instead of returning success.

Fixes 4fc2cf1f2daf ("x86/platform/uv: Add new uv_sysfs platform driver")

Thank you for taking the time to find this.

(With an acknowledgement of Boris's 's/success/random stack memory contents/' comment)

ATM the drivers/platform/x86/uv_sysfs.c only exists in the tip/x86 tree -next branch, so this fix needs to be merged through the tip/x86 tree, here is my ack for merging it that way:

(either with a fixed up commit-msg as suggested by Borislav, or feel free to add it to a fixed v2 of the patch)

Regards,

Hans

Quoted 20 lines
Quoted 19 lines
---
 drivers/platform/x86/uv_sysfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/x86/uv_sysfs.c +1 -1
index 54c342579f1c..e17ce8c4cdad 100644
@@ -248,6 +248,7 @@ static int uv_hubs_init(void)
 		uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL);
 		if (!uv_hubs[i]) {
 			i--;
+			ret = -ENOMEM;
 			goto err_hubs;
 		}
 
--

2.29.2