[PATCH] perf: enum overflow in uapi/linux/perf_event.h
Christophe LEROY
christophe.leroy at c-s.fr
Sat Sep 8 00:15:33 AEST 2018
Le 07/09/2018 à 15:58, Peter Zijlstra a écrit :
> On Fri, Sep 07, 2018 at 01:50:18PM +0000, Christophe Leroy wrote:
>>
>>
>> On 09/07/2018 01:42 PM, Peter Zijlstra wrote:
>>> On Fri, Sep 07, 2018 at 01:27:19PM +0000, Christophe Leroy wrote:
>>>> On PPC32, enums are 32 bits, so __PERF_SAMPLE_CALLCHAIN_EARLY is
>>>> out of scope. The following sparse warning is encountered:
>>>>
>>>> CHECK arch/powerpc/kernel/process.c
>>>> ./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
>>>
>>> Urgh... what compiler is that? I've not seen anything like that from the
>>> build bots.
>>>
>>
>> [root at pc16082vm linux-powerpc]# sparse --version
>> 0.5.2
>>
>> [root at pc16082vm linux-powerpc]# ppc-linux-gcc --version
>> ppc-linux-gcc (GCC) 5.4.0
>
> Ah, that's a sparse warning. But does your GCC agree? The thing is,
> sparse uses the C enum spec, but I suspect GCC uses the C++ enum spec
> and it all works fine.
>
Ah yes, it seems that GCC is happy. So sparse should be fixed instead ?
Anyway, is it really correct to put this constant inside that enum,
after PERF_SAMPLE_MAX ?
Christophe
More information about the Linuxppc-dev
mailing list