* [PATCH] xfs: Add missing braces around xfs_scrub_agfl_info initializer
@ 2018-02-01 10:23 Geert Uytterhoeven
2018-02-01 11:31 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-02-01 10:23 UTC (permalink / raw)
To: Darrick J . Wong
Cc: Arnd Bergmann, linux-xfs, linux-kernel, Geert Uytterhoeven
With gcc-4.1.2:
fs/xfs/scrub/agheader.c: In function ‘xfs_scrub_agfl’:
fs/xfs/scrub/agheader.c:770: warning: missing braces around initializer
fs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)
The first member of struct xfs_scrub_agfl_info is no longer an integral
type, but a struct. Add the missing curly braces to fix this.
Fixes: d852657ccfc0e455 ("xfs: cross-reference reverse-mapping btree")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
index fd975524f4603387..9bcfdb0d1da379f5 100644
--- a/fs/xfs/scrub/agheader.c
+++ b/fs/xfs/scrub/agheader.c
@@ -767,7 +767,7 @@ int
xfs_scrub_agfl(
struct xfs_scrub_context *sc)
{
- struct xfs_scrub_agfl_info sai = { 0 };
+ struct xfs_scrub_agfl_info sai = { { 0 } };
struct xfs_agf *agf;
xfs_agnumber_t agno;
unsigned int agflcount;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs: Add missing braces around xfs_scrub_agfl_info initializer
2018-02-01 10:23 [PATCH] xfs: Add missing braces around xfs_scrub_agfl_info initializer Geert Uytterhoeven
@ 2018-02-01 11:31 ` Arnd Bergmann
2018-02-01 17:08 ` Darrick J. Wong
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2018-02-01 11:31 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Darrick J . Wong, linux-xfs, Linux Kernel Mailing List
On Thu, Feb 1, 2018 at 11:23 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> With gcc-4.1.2:
>
> fs/xfs/scrub/agheader.c: In function ‘xfs_scrub_agfl’:
> fs/xfs/scrub/agheader.c:770: warning: missing braces around initializer
> fs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)
>
> The first member of struct xfs_scrub_agfl_info is no longer an integral
> type, but a struct. Add the missing curly braces to fix this.
I suspect gcc-4.5 is affected as well, but not 4.6+
> --- a/fs/xfs/scrub/agheader.c
> +++ b/fs/xfs/scrub/agheader.c
> @@ -767,7 +767,7 @@ int
> xfs_scrub_agfl(
> struct xfs_scrub_context *sc)
> {
> - struct xfs_scrub_agfl_info sai = { 0 };
> + struct xfs_scrub_agfl_info sai = { { 0 } };
> struct xfs_agf *agf;
Looks ok to me, but
struct xfs_scrub_agfl_info sai = { };
might be slightly better in case the first member changes again.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs: Add missing braces around xfs_scrub_agfl_info initializer
2018-02-01 11:31 ` Arnd Bergmann
@ 2018-02-01 17:08 ` Darrick J. Wong
2018-02-01 17:24 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2018-02-01 17:08 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Geert Uytterhoeven, linux-xfs, Linux Kernel Mailing List
On Thu, Feb 01, 2018 at 12:31:36PM +0100, Arnd Bergmann wrote:
> On Thu, Feb 1, 2018 at 11:23 AM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > With gcc-4.1.2:
> >
> > fs/xfs/scrub/agheader.c: In function ‘xfs_scrub_agfl’:
> > fs/xfs/scrub/agheader.c:770: warning: missing braces around initializer
> > fs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)
> >
> > The first member of struct xfs_scrub_agfl_info is no longer an integral
> > type, but a struct. Add the missing curly braces to fix this.
>
> I suspect gcc-4.5 is affected as well, but not 4.6+
>
> > --- a/fs/xfs/scrub/agheader.c
> > +++ b/fs/xfs/scrub/agheader.c
> > @@ -767,7 +767,7 @@ int
> > xfs_scrub_agfl(
> > struct xfs_scrub_context *sc)
> > {
> > - struct xfs_scrub_agfl_info sai = { 0 };
> > + struct xfs_scrub_agfl_info sai = { { 0 } };
> > struct xfs_agf *agf;
>
> Looks ok to me, but
>
> struct xfs_scrub_agfl_info sai = { };
>
> might be slightly better in case the first member changes again.
Frankly I'd rather see it changed to memset(&sai, 0, sizeof(sai)); and
stop having to field all these gcc warnings that vary depending on
compiler version...
--D
>
> Arnd
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs: Add missing braces around xfs_scrub_agfl_info initializer
2018-02-01 17:08 ` Darrick J. Wong
@ 2018-02-01 17:24 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2018-02-01 17:24 UTC (permalink / raw)
To: Darrick J. Wong, Arnd Bergmann
Cc: Geert Uytterhoeven, linux-xfs, Linux Kernel Mailing List
On Thu, 2018-02-01 at 09:08 -0800, Darrick J. Wong wrote:
> On Thu, Feb 01, 2018 at 12:31:36PM +0100, Arnd Bergmann wrote:
> > On Thu, Feb 1, 2018 at 11:23 AM, Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > With gcc-4.1.2:
> > >
> > > fs/xfs/scrub/agheader.c: In function ‘xfs_scrub_agfl’:
> > > fs/xfs/scrub/agheader.c:770: warning: missing braces around initializer
> > > fs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)
> > >
> > > The first member of struct xfs_scrub_agfl_info is no longer an integral
> > > type, but a struct. Add the missing curly braces to fix this.
> >
> > I suspect gcc-4.5 is affected as well, but not 4.6+
> >
> > > --- a/fs/xfs/scrub/agheader.c
> > > +++ b/fs/xfs/scrub/agheader.c
> > > @@ -767,7 +767,7 @@ int
> > > xfs_scrub_agfl(
> > > struct xfs_scrub_context *sc)
> > > {
> > > - struct xfs_scrub_agfl_info sai = { 0 };
> > > + struct xfs_scrub_agfl_info sai = { { 0 } };
> > > struct xfs_agf *agf;
> >
> > Looks ok to me, but
> >
> > struct xfs_scrub_agfl_info sai = { };
> >
> > might be slightly better in case the first member changes again.
>
> Frankly I'd rather see it changed to memset(&sai, 0, sizeof(sai)); and
> stop having to field all these gcc warnings that vary depending on
> compiler version...
trivia:
memset should also be preferred if the structure
could be copied to userspace as the "= {}" is not
guaranteed to zero any possible padding or member
alignment holes.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-01 17:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 10:23 [PATCH] xfs: Add missing braces around xfs_scrub_agfl_info initializer Geert Uytterhoeven
2018-02-01 11:31 ` Arnd Bergmann
2018-02-01 17:08 ` Darrick J. Wong
2018-02-01 17:24 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).