bus: mvebu-mbus: potential forever loop in mvebu_mbus_init()
Subsystems (2)
PATCH 1/1 bus: mvebu-mbus: potential forever loop in mvebu_mbus_init()
"of_id->compatible" is an array and not a pointer so it can never be NULL.
---
I'm not able to compile this.
drivers/bus/mvebu-mbus.c +2 -2
@@ -734,11 +734,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, {const struct of_device_id *of_id; -for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) +for (of_id = of_mvebu_mbus_ids; of_id->compatible[0 ]; of_id++)if (!strcmp (of_id->compatible, soc))break ; -if (!of_id->compatible) { +if (!of_id->compatible[0 ]) {pr_err ("could not find a matching SoC family\n" );return -ENODEV ; }
Dan,
Quoted 2 lines · Dan Carpenter
"
of_id->compatible" is an array and not a pointer so it can never be NULL.
Thanks for pointing this out.
Quoted 9 lines
Signed-off-by Dan Carpenter <[email protected]>---
I'm not able to compile this.drivers/bus/mvebu-mbus.c +0
-0
drivers/bus/mvebu-mbus.c int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, · line 739
Quoted 7 lines
drivers/bus/mvebu-mbus.c +1
-1@@ -734,11 +734,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, {const struct of_device_id *of_id; -for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) +for (of_id = of_mvebu_mbus_ids; of_id->compatible[0 ]; of_id++)if (!strcmp (of_id->compatible, soc))break ;
Ezequiel et al,
The comment above the declaration for of_mvebu_mbus_ids says:
/*
* The driver doesn't yet have a DT binding because the details of
* this DT binding still need to be sorted out. However, as a
* preparation, we already use of_device_id to match a SoC description
* string against the SoC specific details of this driver. */
I believe we have a binding now. ;-) Care to look this over and provide a more complete cleanup patch?
thx,
Jason.
Quoted 15 lines · Dan Carpenter
"
of_id->compatible" is an array and not a pointer so it can never be NULL.Signed-off-by Dan Carpenter <[email protected]>---
I'm not able to compile this.drivers/bus/mvebu-mbus.c +0
-0@@ -734,11 +734,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, {const struct of_device_id *of_id;
drivers/bus/mvebu-mbus.c int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, · line 744
Quoted 10 lines
drivers/bus/mvebu-mbus.c +2
-2-for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) +for (of_id = of_mvebu_mbus_ids; of_id->compatible[0 ]; of_id++)if (!strcmp (of_id->compatible, soc))break ; -if (!of_id->compatible) { +if (!of_id->compatible[0 ]) {pr_err ("could not find a matching SoC family\n" );return -ENODEV ; }
Nice catch.
Just for the sake of it, I reproduced the bug, and then tested it's solved by the patch. The issue only hits the old platforms that aren't converted to DT.
IMHO, this is a "potential" bug, trigerred only if the code itself is wrong (which is not) and it's not serious enough to hit stable.
Signature · 7 lines
Ezequiel GarcÃa, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com -- 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
Quoted 36 lines · Jason Cooper
Dan,
Quoted 2 lines · Dan Carpenter
"
of_id->compatible" is an array and not a pointer so it can never be NULL.Thanks for pointing this out.
Quoted 9 lines
Signed-off-by Dan Carpenter <[email protected]>---
I'm not able to compile this.drivers/bus/mvebu-mbus.c +0
-0drivers/bus/mvebu-mbus.c int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, · line 739
Quoted 7 lines
drivers/bus/mvebu-mbus.c +1
-1@@ -734,11 +734,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, {const struct of_device_id *of_id; -for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) +for (of_id = of_mvebu_mbus_ids; of_id->compatible[0 ]; of_id++)if (!strcmp (of_id->compatible, soc))break ;Ezequiel et al,
The comment above the declaration for
of_mvebu_mbus_idssays:/*
* The driver doesn't yet have a DT binding because the details of
* this DT binding still need to be sorted out. However, as a
* preparation, we already useof_device_idto match a SoC description
* string against the SoC specific details of this driver. */
Quoted 3 lines
I believe we have a binding now. ;-) Care to look this over and provide a more complete cleanup patch?
Sure.
Signature · 7 lines
Ezequiel GarcÃa, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com -- 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
Quoted 6 lines · Dan Carpenter
"
of_id->compatible" is an array and not a pointer so it can never be NULL.Signed-off-by Dan Carpenter <[email protected]>---
I'm not able to compile this.
Compile tested with mvebu_defconfig for ARCH=arm. Applied to mvebu/drivers
thx,
Jason.
Quoted 29 lines · Ezequiel Garcia
Quoted 15 lines · Dan Carpenter
"
of_id->compatible" is an array and not a pointer so it can never be NULL.Signed-off-by Dan Carpenter <[email protected]>---
I'm not able to compile this.drivers/bus/mvebu-mbus.c +0
-0@@ -734,11 +734,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, {const struct of_device_id *of_id;drivers/bus/mvebu-mbus.c int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, · line 744
Quoted 10 lines
drivers/bus/mvebu-mbus.c +2
-2-for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) +for (of_id = of_mvebu_mbus_ids; of_id->compatible[0 ]; of_id++)if (!strcmp (of_id->compatible, soc))break ; -if (!of_id->compatible) { +if (!of_id->compatible[0 ]) {pr_err ("could not find a matching SoC family\n" );return -ENODEV ; }Nice catch.
Quoted 6 lines
Just for the sake of it, I reproduced the bug, and then tested it's solved by the patch. The issue only hits the old platforms that aren't converted to DT.
Acked-by Ezequiel Garcia <[email protected]>
Jason:
FWIW, in case you've missed this mail, I tested this when Dan reported it. See above.
Signature · 7 lines
Ezequiel GarcÃa, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com -- 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
Quoted 34 lines · Ezequiel Garcia
Quoted 33 lines · Ezequiel Garcia
Quoted 15 lines · Dan Carpenter
"
of_id->compatible" is an array and not a pointer so it can never be NULL.Signed-off-by Dan Carpenter <[email protected]>---
I'm not able to compile this.drivers/bus/mvebu-mbus.c +0
-0@@ -734,11 +734,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, {const struct of_device_id *of_id;drivers/bus/mvebu-mbus.c int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, · line 744
Quoted 10 lines
drivers/bus/mvebu-mbus.c +2
-2-for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) +for (of_id = of_mvebu_mbus_ids; of_id->compatible[0 ]; of_id++)if (!strcmp (of_id->compatible, soc))break ; -if (!of_id->compatible) { +if (!of_id->compatible[0 ]) {pr_err ("could not find a matching SoC family\n" );return -ENODEV ; }Nice catch.
Just for the sake of it, I reproduced the bug, and then tested it's solved by the patch. The issue only hits the old platforms that aren't converted to DT.
Quoted 7 lines
Quoted 2 lines
Acked-by Ezequiel Garcia <[email protected]>Jason:
FWIW, in case you've missed this mail, I tested this when Dan reported it. See above.
Fixed. Sorry I missed that.
thx,
Jason.