lkml.org 
[lkml]   [2020]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] fsnotify: avoid gcc-10 zero-length-bounds warning
From
Date


On 5/5/20 10:00, Arnd Bergmann wrote:
> On Tue, May 5, 2020 at 4:35 PM Gustavo A. R. Silva
> <gustavo@embeddedor.com> wrote:
>> On 5/5/20 09:30, Arnd Bergmann wrote:
>>> gcc-10 warns about accesses into the f_handle[] zero-length array.
>>>
>>> fs/notify/fdinfo.c: In function 'show_mark_fhandle':
>>> fs/notify/fdinfo.c:66:47: error: array subscript 'i' is outside the bounds of an interior zero-length array 'unsigned char[0]' [-Werror=zero-length-bounds]
>>> 66 | seq_printf(m, "%02x", (int)f.handle.f_handle[i]);
>>> | ~~~~~~~~~~~~~~~~~^~~
>>> In file included from fs/notify/fdinfo.c:3:
>>> include/linux/fs.h:988:16: note: while referencing 'f_handle'
>>> 988 | unsigned char f_handle[0];
>>> | ^~~~~~~~
>>>
>>> This is solved by using a flexible array instead.
>>>
>>> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> ---
>>> Gustavo has done the same thing as part of a treewide change, but keeping
>>> this separate lets us backport it to stable kernels more easily later.
>>
>> Arnd,
>>
>> I wonder why would we need to backport these changes to -stable... merely
>> because of the use of a new version of GCC?
>
> Yes, we usually backport trivial warning fixes to stable kernels to allow
> building those with any modern compiler version.
>

OK. So, if you anticipate that this is going to happen, I can split up my
treewide patch into separate per-subsystem patches. I can replace the
treewide patch in my tree today, so the changes are reflected in tomorrow's
linux-next.

--
Gustavo

\
 
 \ /
  Last update: 2020-05-05 17:08    [W:0.099 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site