Re: [PATCH] perf/x86/uncore: clean up const mismatch

From: Greg Kroah-Hartman
Date: Thu Dec 18 2025 - 04:59:35 EST


On Thu, Dec 18, 2025 at 09:55:51AM +0100, Peter Zijlstra wrote:
> On Wed, Dec 17, 2025 at 01:42:41PM +0100, Greg Kroah-Hartman wrote:
> > In some cmp functions, a const pointer is cast out to a non-const
> > pointer by using container_of() which is not correct. Fix this up by
> > properly marking the pointers as const, which preserves the correct
> > type of the pointer passed into the functions.
>
> How did you find this? My builds do not complain and all that.

I have a local change that turns container_of() into container_of_const():
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=container_of_const_mess&id=ea8cab3db2b5a56c5ef63d0e32accce58eb9bb2c
that I'm using to sweep the tree and fix up all of the places we have
gotten this wrong. And wow, have we gotten it wrong in so many
places...

It's a slow grind, I'll get there eventually and then will merge a patch
that forces container_of() to catch this type of thing so it will not
come back in the future. Maybe a year or so, no real rush :)

thanks,

greg k-h