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

From: Horst von Brand (vonbrand@inf.utfsm.cl)
Date: Sun Sep 29 2002 - 19:59:50 EST


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/



This archive was generated by hypermail 2b29 : Mon Sep 30 2002 - 22:00:43 EST