[PATCH v3 5/5] powernv:cpufreq: Implement the driver->get() method
David Laight
David.Laight at ACULAB.COM
Sat Mar 22 02:01:09 EST 2014
From: Viresh Kumar [mailto:viresh.kumar at linaro.org]
> On 21 March 2014 17:31, David Laight <David.Laight at aculab.com> wrote:
> >> *(int *)ret_freq = freq;
> >
> > Because it is very likely to be wrong.
> > In general casts of pointers to integer types are dangerous.
>
> Where are we converting pointers to integers? We are doing a
> cast from 'void * ' to 'int *' and then using indirection operator
> to set its value.
You mis-parsed what I wrote, try:
In general casts of 'pointer to integer' types are dangerous.
Somewhere, much higher up the call stack, the address of an integer
variable is being taken and then passed as the 'void *' parameter.
The 'problem' is that it is quite easily to pass the address of
a 'long' instead. On 32bit and LE systems this won't always
be a problem. On 64bit BE it all goes wrong.
David
More information about the Linuxppc-dev
mailing list