Skip to contentSkip to conversation

clk: vexpress: NULL dereference on error path

PATCH In review Dan Carpenter 2 participants 6 messages Nov 7, 2013 – Apr 23, 2014

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

PATCH 1/1 clk: vexpress: NULL dereference on error path

If the allocation fails then we dereference the NULL in the error path. Just return directly.

Fixes ed27ff1db869 ('clk: Versatile Express clock generators ("osc") driver')
drivers/clk/versatile/clk-vexpress-osc.c +1 -1
index 2dc8b41..a535c7b 100644
@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node)
 
 	osc = kzalloc(sizeof(*osc), GFP_KERNEL);
 	if (!osc)
-		goto error;
+		return;
 
 	osc->func = vexpress_config_func_get_by_node(node);
 	if (!osc->func) {
#1 lore raw
Quoted 11 lines · Dan Carpenter

If the allocation fails then we dereference the NULL in the error path. Just return directly.

Fixes ed27ff1db869 ('clk: Versatile Express clock generators ("osc") driver')
drivers/clk/versatile/clk-vexpress-osc.c +0 -0
index 2dc8b41..a535c7b 100644

drivers/clk/versatile/clk-vexpress-osc.c void __init vexpress_osc_of_setup(struct device_node *node) · line 108

Quoted 8 lines
drivers/clk/versatile/clk-vexpress-osc.c +1 -1
@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node)
 
 	osc = kzalloc(sizeof(*osc), GFP_KERNEL);
 	if (!osc)
-		goto error;
+		return;
 
 	osc->func = vexpress_config_func_get_by_node(node);
 	if (!osc->func) {

Well spotted, thanks!

Will get it queued with other vexpress clk changes.

Paweł

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by
#2 lore raw
Quoted 18 lines · Pawel Moll
Quoted 17 lines · Dan Carpenter

If the allocation fails then we dereference the NULL in the error path. Just return directly.

Fixes ed27ff1db869 ('clk: Versatile Express clock generators ("osc") driver')
drivers/clk/versatile/clk-vexpress-osc.c +1 -1
index 2dc8b41..a535c7b 100644
@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node)
 
 	osc = kzalloc(sizeof(*osc), GFP_KERNEL);
 	if (!osc)
-		goto error;
+		return;
 
Quoted 6 lines

drivers/clk/versatile/clk-vexpress-osc.c void __init vexpress_osc_of_setup(struct device_node *node) · line 108

Quoted 2 lines
drivers/clk/versatile/clk-vexpress-osc.c +0 -0
 	osc->func = vexpress_config_func_get_by_node(node);
 	if (!osc->func) {

Well spotted, thanks!

Will get it queued with other vexpress clk changes.

Having said that - Mike, it's a bug fix. If you can still get it into the current merge window, please do:

Paweł

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 24 lines · Pawel Moll
Quoted 23 lines · Pawel Moll
Quoted 11 lines · Dan Carpenter

If the allocation fails then we dereference the NULL in the error path. Just return directly.

Fixes ed27ff1db869 ('clk: Versatile Express clock generators ("osc") driver')
drivers/clk/versatile/clk-vexpress-osc.c +0 -0
index 2dc8b41..a535c7b 100644

drivers/clk/versatile/clk-vexpress-osc.c void __init vexpress_osc_of_setup(struct device_node *node) · line 108

Quoted 8 lines
drivers/clk/versatile/clk-vexpress-osc.c +1 -1
@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node)
 
 	osc = kzalloc(sizeof(*osc), GFP_KERNEL);
 	if (!osc)
-		goto error;
+		return;
 
 	osc->func = vexpress_config_func_get_by_node(node);
 	if (!osc->func) {

Well spotted, thanks!

Quoted 7 lines
Quoted 1 line

Will get it queued with other vexpress clk changes.

Having said that - Mike, it's a bug fix. If you can still get it into the current merge window, please do:

Heh. Let's try again to get this merged. :P

regards,
dan carpenter

#4 lore raw
Quoted 27 lines · Dan Carpenter
Quoted 26 lines · Pawel Moll
Quoted 24 lines · Pawel Moll
Quoted 11 lines · Dan Carpenter

If the allocation fails then we dereference the NULL in the error path. Just return directly.

Fixes ed27ff1db869 ('clk: Versatile Express clock generators ("osc") driver')
drivers/clk/versatile/clk-vexpress-osc.c +0 -0
index 2dc8b41..a535c7b 100644

drivers/clk/versatile/clk-vexpress-osc.c void __init vexpress_osc_of_setup(struct device_node *node) · line 108

Quoted 8 lines
drivers/clk/versatile/clk-vexpress-osc.c +1 -1
@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node)
 
 	osc = kzalloc(sizeof(*osc), GFP_KERNEL);
 	if (!osc)
-		goto error;
+		return;
 
 	osc->func = vexpress_config_func_get_by_node(node);
 	if (!osc->func) {

Well spotted, thanks!

Will get it queued with other vexpress clk changes.

Quoted 7 lines
Quoted 5 lines

Having said that - Mike, it's a bug fix. If you can still get it into the current merge window, please do:

Heh. Let's try again to get this merged. :P

Right, my fault, haven't followed this up with Mike, sorry.

Pawel

#5 lore raw
Quoted 9 lines · Pawel Moll
Quoted 7 lines
Quoted 5 lines

Having said that - Mike, it's a bug fix. If you can still get it into the current merge window, please do:

Heh. Let's try again to get this merged. :P

Right, my fault, haven't followed this up with Mike, sorry.

Mike, will you take it in as a fix for 3.15, or do you want me to queue it with other vexpress fixes and go through arm-soc?

Cheers!

Pawel