public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Paul Walmsley <paul@pwsan.com>
Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH B 01/10] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk
Date: Sat, 31 Jan 2009 11:55:23 +0000	[thread overview]
Message-ID: <20090131115523.GF1394@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20090128024401.27240.68328.stgit@localhost.localdomain>

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.

  reply	other threads:[~2009-01-31 11:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28  2:44 [PATCH B 00/10] OMAP clock, B of F: clockdomain, powerdomain updates Paul Walmsley
2009-01-28  2:44 ` [PATCH B 01/10] OMAP2/3 clock: combine clkdm, clkdm_name into union in struct clk Paul Walmsley
2009-01-31 11:55   ` Russell King - ARM Linux [this message]
2009-02-03  8:47     ` Paul Walmsley
2009-02-04 22:47       ` Paul Walmsley
2009-01-28  2:44 ` [PATCH B 02/10] OMAP2/3 clockdomains: combine pwrdm, pwrdm_name into union in struct clockdomain Paul Walmsley
2009-01-31 12:01   ` Russell King - ARM Linux
2009-02-03  9:20     ` Paul Walmsley
2009-02-03 15:52       ` Russell King - ARM Linux
2009-02-04 20:48         ` Paul Walmsley
2009-01-28  2:44 ` [PATCH B 03/10] OMAP2/3 clockdomains: add CM, PRM, virt_opp_clkdm clockdomains Paul Walmsley
2009-01-31 14:09   ` Russell King - ARM Linux
2009-01-28  2:44 ` [PATCH B 04/10] OMAP3 PRCM: add DPLL1-5 powerdomains, clockdomains; mark clocks Paul Walmsley
2009-01-31 14:17   ` Russell King - ARM Linux
2009-01-28  2:44 ` [PATCH B 06/10] OMAP3 pwrdm: add CORE SAR handling (for USBTLL module) Paul Walmsley
2009-01-29  2:21   ` Woodruff, Richard
2009-01-29  7:47     ` Paul Walmsley
2009-01-29  9:15       ` Paul Walmsley
2009-01-31 14:22         ` Russell King - ARM Linux
2009-02-06  3:52           ` Paul Walmsley
2009-02-23 14:38             ` Russell King - ARM Linux
2009-02-28  0:47               ` Paul Walmsley
2009-01-28  2:44 ` [PATCH B 07/10] OMAP3 powerdomains: remove RET from SGX power states list Paul Walmsley
2009-01-28  2:44 ` [PATCH B 08/10] OMAP: wait for pwrdm transition after clk_enable() Paul Walmsley
2009-01-28  2:44 ` [PATCH B 09/10] OMAP2/3 clockdomains: autodeps should respect platform flags Paul Walmsley
2009-01-28  2:44 ` [PATCH B 10/10] OMAP3: PM: Emu_pwrdm is switched off by hardware even when sdti is in use Paul Walmsley
     [not found] ` <20090128024418.27240.52292.stgit@localhost.localdomain>
2009-01-31 14:21   ` [PATCH B 05/10] OMAP2/3 clock: add clockdomains to all remaining clocks; fix clkdm init Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090131115523.GF1394@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox