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

From: Viresh Kumar
Date: Wed Oct 07 2015 - 12:37:12 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/