linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: workaround gcc <4.6 build error in link_path_walk()
@ 2014-09-16 12:07 James Hogan
  2014-09-16 17:39 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: James Hogan @ 2014-09-16 12:07 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, James Hogan, Alexander Viro, Geert Uytterhoeven,
	linux-fsdevel, linux-metag

Commit d6bb3e9075bb (vfs: simplify and shrink stack frame of
link_path_walk()) introduced build problems with GCC versions older than
4.6 due to the initialisation of a member of an anonymous union in
struct qstr without enclosing braces.

This hits GCC bug 10676 [1] (which was fixed in GCC 4.6 by [2]), and
causes the following build error:
  fs/namei.c: In function 'link_path_walk':
  fs/namei.c:1778: error: unknown field 'hash_len' specified in initializer

This is worked around by adding explicit braces.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676
[2] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=159206

Fixes: d6bb3e9075bb (vfs: simplify and shrink stack frame of link_path_walk())
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-metag@vger.kernel.org
---
At least for metag it's feasible to fix the compiler, since backporting
the fix to GCC 4.2.4 isn't actually very difficult. I don't know about
other users of GCC <4.6 though.
---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index 01d03892316c..a7b05bf82d31 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1775,7 +1775,7 @@ static int link_path_walk(const char *name, struct nameidata *nd)
 			struct dentry *parent = nd->path.dentry;
 			nd->flags &= ~LOOKUP_JUMPED;
 			if (unlikely(parent->d_flags & DCACHE_OP_HASH)) {
-				struct qstr this = { .hash_len = hash_len, .name = name };
+				struct qstr this = { { .hash_len = hash_len }, .name = name };
 				err = parent->d_op->d_hash(parent, &this);
 				if (err < 0)
 					break;
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vfs: workaround gcc <4.6 build error in link_path_walk()
  2014-09-16 12:07 [PATCH] vfs: workaround gcc <4.6 build error in link_path_walk() James Hogan
@ 2014-09-16 17:39 ` Al Viro
  2014-09-17 14:05   ` James Hogan
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2014-09-16 17:39 UTC (permalink / raw)
  To: James Hogan
  Cc: Linus Torvalds, linux-kernel, Geert Uytterhoeven, linux-fsdevel,
	linux-metag

On Tue, Sep 16, 2014 at 01:07:35PM +0100, James Hogan wrote:
> Commit d6bb3e9075bb (vfs: simplify and shrink stack frame of
> link_path_walk()) introduced build problems with GCC versions older than
> 4.6 due to the initialisation of a member of an anonymous union in
> struct qstr without enclosing braces.
> 
> This hits GCC bug 10676 [1] (which was fixed in GCC 4.6 by [2]), and
> causes the following build error:
>   fs/namei.c: In function 'link_path_walk':
>   fs/namei.c:1778: error: unknown field 'hash_len' specified in initializer
> 
> This is worked around by adding explicit braces.

IOW, the same thing QSTR_INIT is doing...  BTW, after looking at the commit
in question, what the hell was this
+                               name = this.name;
in link_path_walk() about?  Granted, none of the ->d_hash() instances in
the tree reassign qstr->name, and out-of-tree ones are unlikely to do it
either, so it's harmless but... why bother rereading this.name at all?
Linus?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vfs: workaround gcc <4.6 build error in link_path_walk()
  2014-09-16 17:39 ` Al Viro
@ 2014-09-17 14:05   ` James Hogan
  0 siblings, 0 replies; 3+ messages in thread
From: James Hogan @ 2014-09-17 14:05 UTC (permalink / raw)
  To: Al Viro
  Cc: Linus Torvalds, linux-kernel, Geert Uytterhoeven, linux-fsdevel,
	linux-metag

On 16/09/14 18:39, Al Viro wrote:
> On Tue, Sep 16, 2014 at 01:07:35PM +0100, James Hogan wrote:
>> Commit d6bb3e9075bb (vfs: simplify and shrink stack frame of
>> link_path_walk()) introduced build problems with GCC versions older than
>> 4.6 due to the initialisation of a member of an anonymous union in
>> struct qstr without enclosing braces.
>>
>> This hits GCC bug 10676 [1] (which was fixed in GCC 4.6 by [2]), and
>> causes the following build error:
>>   fs/namei.c: In function 'link_path_walk':
>>   fs/namei.c:1778: error: unknown field 'hash_len' specified in initializer
>>
>> This is worked around by adding explicit braces.
> 
> IOW, the same thing QSTR_INIT is doing...

QSTR_INIT only initialises len and name, not the hash.

Cheers
James

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-17 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-16 12:07 [PATCH] vfs: workaround gcc <4.6 build error in link_path_walk() James Hogan
2014-09-16 17:39 ` Al Viro
2014-09-17 14:05   ` James Hogan

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).