Re: [PATCH] Re: [2.5.39] (3/5) CPUfreq i386 drivers

Horst von Brand (vonbrand@inf.utfsm.cl)
Sun, 29 Sep 2002 20:59:50 -0400


Gerald Britton <gbritton@alum.mit.edu> said:
> On Sun, Sep 29, 2002 at 12:10:18PM +0200, Dominik Brodowski wrote:
> > I think I found the problem: it should be GFP_ATOMIC and not GFP_KERNEL in
> > the allocation of struct cpufreq_driver. Will be fixed in the next release.
>
> Nope. That should be fine, it's in a process context and not holding any
> locks, so GFP_KERNEL should be fine. I found the bug though:
>
> -driver->policy = (struct cpufreq_policy *) (driver + sizeof(struct cpufreq_dri
> ver));
> +driver->policy = (struct cpufreq_policy *) (driver + 1);
>
> Remember your pointer arithmetic.

Perhaps you should create a local variable of the right type:

struct cpufreq_policy *local_var = (struct cpufreq_policy *)driver;

driver->policy = &local_var[1];

(gcc should be smart enough to loose it)

[In any case, making this part of driver point at itself looks wrong to me...]

-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/