Re: [peterz-queue:perf/core 18/22] kernel/events/core.c:6418:22: sparse: sparse: incorrect type in assignment (different address spaces)

From: Peter Zijlstra
Date: Thu Apr 15 2021 - 05:12:03 EST


On Thu, Apr 15, 2021 at 11:03:09AM +0200, Marco Elver wrote:
> On Thu, Apr 15, 2021 at 10:48AM +0200, Peter Zijlstra wrote:

> > I've ended up with the below delta, does that work for you?
>
> Thanks, that works for me. Do note that I explicitly chose u64 for
> sig_addr/pending_addr because data->addr is u64. There might be a new
> warning about the u64 to unsigned long assignment on 32 bit arches.

My local i386-defconfig build seemed happy now. Mostly I think you're
allowed to silently truncate between base integer types. We'll see..
maybe some other compiler.

> Perhaps it needs something ugly like this:
>
> info.si_addr = (void __user *)(unsigned long)event->pending_addr;
>
> if pending_addr wants to be u64. Or just
>
> event->pending_addr = (unsigned long)data->addr;
>
> if data->addr being u64 on 32 bit arches is simply overkill.

Yeah it is. It's u64 for data layout purposes, the perf buffer works in
u64 chunks.