All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Amir Goldstein <amir73il@gmail.com>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fsnotify: avoid gcc-10 zero-length-bounds warning
Date: Tue, 5 May 2020 10:11:39 -0500	[thread overview]
Message-ID: <1f33eec3-4851-e423-2d04-e02da25e2e6e@embeddedor.com> (raw)
In-Reply-To: <CAK8P3a0v-hK+Ury86-1D2_jfOFgR8ZTEFKVQZBWJq3dW=MuSzw@mail.gmail.com>



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

  reply	other threads:[~2020-05-05 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 14:30 [PATCH] fsnotify: avoid gcc-10 zero-length-bounds warning Arnd Bergmann
2020-05-05 14:39 ` Gustavo A. R. Silva
2020-05-05 15:00   ` Arnd Bergmann
2020-05-05 15:11     ` Gustavo A. R. Silva [this message]
2020-05-05 15:23       ` Arnd Bergmann
2020-05-05 16:58         ` Linus Torvalds
2020-05-07  8:01     ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f33eec3-4851-e423-2d04-e02da25e2e6e@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=akpm@linux-foundation.org \
    --cc=amir73il@gmail.com \
    --cc=arnd@arndb.de \
    --cc=darrick.wong@oracle.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.