[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090131115523.GF1394@n2100.arm.linux.org.uk>
Date: Sat, 31 Jan 2009 11:55:23 +0000
From: Russell King - ARM Linux <linux@....linux.org.uk>
To: Paul Walmsley <paul@...an.com>
Cc: linux-arm-kernel@...ts.arm.linux.org.uk,
linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
Tony Lindgren <tony@...mide.com>
Subject: Re: [PATCH B 01/10] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
On Tue, Jan 27, 2009 at 07:44:08PM -0700, Paul Walmsley wrote:
> diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
> index 55c5d67..7aa09f5 100644
> --- a/arch/arm/mach-omap2/clock.c
> +++ b/arch/arm/mach-omap2/clock.c
> @@ -77,17 +77,17 @@ void omap2_init_clk_clkdm(struct clk *clk)
> {
> struct clockdomain *clkdm;
>
> - if (!clk->clkdm_name)
> + if (!clk->clkdm.name)
> return;
>
> - clkdm = clkdm_lookup(clk->clkdm_name);
> + clkdm = clkdm_lookup(clk->clkdm.name);
> if (clkdm) {
> pr_debug("clock: associated clk %s to clkdm %s\n",
> - clk->name, clk->clkdm_name);
> - clk->clkdm = clkdm;
> + clk->name, clk->clkdm.name);
> + clk->clkdm.ptr = clkdm;
> } else {
> pr_debug("clock: could not associate clk %s to "
> - "clkdm %s\n", clk->name, clk->clkdm_name);
> + "clkdm %s\n", clk->name, clk->clkdm.name);
> }
This is unsafe - if the clock domain can not be found, you leave the
union pointing at the string, and there's no way for this to prevent
the clock from being registered.
The result is that:
> - if (clk->clkdm)
> - omap2_clkdm_clk_disable(clk->clkdm, clk);
> + if (clk->clkdm.ptr)
> + omap2_clkdm_clk_disable(clk->clkdm.ptr, clk);
and similar places will pass the pointer to the string, potentially
causing an oops, or worse, data corruption due to scribbing over
someone elses memory.
So I don't think this patch is acceptable as-is.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists