[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c9e5e3f2-977d-b143-a25f-e2fcaafad27c@de.ibm.com>
Date: Wed, 15 Feb 2017 17:20:06 +0100
From: Christian Borntraeger <borntraeger@...ibm.com>
To: Arnd Bergmann <arnd@...db.de>, Dmitry Vyukov <dvyukov@...gle.com>
Cc: "kasan-dev@...glegroups.com" <kasan-dev@...glegroups.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] kasan stack overflow warnings again: READ_ONCE(),
typecheck()
On 02/15/2017 05:18 PM, Christian Borntraeger wrote:
> On 02/15/2017 12:03 AM, Arnd Bergmann wrote:
>>
>> -#define WRITE_ONCE(x, val) \
>> -({ \
>> - union { typeof(x) __val; char __c[1]; } __u = \
>> - { .__val = (__force typeof(x)) (val) }; \
>> - __write_once_size(&(x), __u.__c, sizeof(x)); \
>> - __u.__val; \
>> -})
>> +#define WRITE_ONCE(x, val) \
>> +( \
>> + __builtin_choose_expr(sizeof(x) == 1, *(volatile typeof(&(x)))&(x) = (val), \
>> + __builtin_choose_expr(sizeof(x) == 2, *(volatile typeof(&(x)))&(x) = (val), \
>> + __builtin_choose_expr(sizeof(x) == 4, *(volatile typeof(&(x)))&(x) = (val), \
>> + __builtin_choose_expr(sizeof(x) == sizeof(long), *(volatile typeof(&(x)))&(x) = (val), \
>
> Have you run sparse on those changes?
> IIRC we had to add the __force to get rid of address space annotations
> in that macro above. Cannot tell if we need something like that here.
>
The original warning was
fs/afs/inode.c:448:9: sparse: incorrect type in initializer (different address spaces)
fs/afs/inode.c:448:9: expected struct afs_permits *__val
fs/afs/inode.c:448:9: got void [noderef] <asn:4>*<noident>
Powered by blists - more mailing lists