[PATCH] PM / OPP: fix debugfs files for 64-bit

Viresh Kumar viresh.kumar at linaro.org
Wed Oct 7 09:36:59 PDT 2015


On 07-10-15, 17:33, Russell King - ARM Linux wrote:
> Don't you even think about doing that - that's totally broken no matter
> what, and this is a good example of why casts are Bad.
> 
> debugfs_create_u64() will create a debugfs object that will want to
> access a 64-bit value, but the value pointed to is only 32-bit.  The
> net result is that the debugfs file ends up reading or writing the
> neigbouring 32-bits, which may potentially be unaligned.

Yeah, that's what I was also saying. Its broken.

> The variable pointed to for debugfs_create_u64() must be a 64-bit
> value.  No casts allowed.
> 
> An alternative would be to have debugfs_create_ulong()

And that's what I suggested.

-- 
viresh



More information about the linux-arm-kernel mailing list