Re: [patch] bus: mvebu-mbus: potential forever loop in mvebu_mbus_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 13, 2013 at 10:50:24AM +0300, Dan Carpenter wrote:
> "of_id->compatible" is an array and not a pointer so it can never be
> NULL.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> I'm not able to compile this.
> 
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index 2394e97..c646a76 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -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;
>  	}

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.

Acked-by: Ezequiel Garcia <ezequiel.garcia@xxxxxxxxxxxxxxxxxx>

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.
-- 
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux