xfs: Add missing braces around xfs_scrub_agfl_info initializer
PATCH 1/1 xfs: Add missing braces around xfs_scrub_agfl_info initializer
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.
--- fs/xfs/scrub/agheader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/scrub/agheader.c +1 -1
@@ -767,7 +767,7 @@ intxfs_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;
Signature · 1 line
2.7.4
Quoted 8 lines · 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 initializerfs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)The first member of struct
xfs_scrub_agfl_infois 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+
fs/xfs/scrub/agheader.c int · line 771
Quoted 9 lines
fs/xfs/scrub/agheader.c +1
-1@@ -767,7 +767,7 @@ intxfs_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
Quoted 25 lines · Arnd Bergmann
Quoted 8 lines · 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 initializerfs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)The first member of struct
xfs_scrub_agfl_infois 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+
fs/xfs/scrub/agheader.c int · line 771
Quoted 9 lines
fs/xfs/scrub/agheader.c +1
-1@@ -767,7 +767,7 @@ intxfs_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
Quoted 3 lines
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
Quoted 6 lines
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 26 lines · Darrick J. Wong
Quoted 25 lines · Arnd Bergmann
Quoted 8 lines · 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 initializerfs/xfs/scrub/agheader.c:770: warning: (near initialization for ‘sai.oinfo’)The first member of struct
xfs_scrub_agfl_infois 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+
fs/xfs/scrub/agheader.c int · line 771
Quoted 9 lines
fs/xfs/scrub/agheader.c +1
-1@@ -767,7 +767,7 @@ intxfs_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
Quoted 7 lines
Quoted 3 lines
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.