diff mbox

fs/crypto/hooks.c: fix build with pre-4.6 gcc versions

Message ID 20180119214524.222850-1-ebiggers3@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Eric Biggers Jan. 19, 2018, 9:45 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

gcc versions prior to 4.6 require an extra level of braces when using a
designated initializer for a member in an anonymous struct or union.
This caused a compile error with the 'struct qstr' initialization in
__fscrypt_encrypt_symlink().

Fix it by using QSTR_INIT().

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Fixes: 76e81d6d5048 ("fscrypt: new helper functions for ->symlink()")
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/crypto/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Morton Jan. 19, 2018, 9:53 p.m. UTC | #1
On Fri, 19 Jan 2018 13:45:24 -0800 Eric Biggers <ebiggers3@gmail.com> wrote:

> From: Eric Biggers <ebiggers@google.com>
> 
> gcc versions prior to 4.6 require an extra level of braces when using a
> designated initializer for a member in an anonymous struct or union.
> This caused a compile error with the 'struct qstr' initialization in
> __fscrypt_encrypt_symlink().
> 
> Fix it by using QSTR_INIT().
> 
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Fixes: 76e81d6d5048 ("fscrypt: new helper functions for ->symlink()")
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Tested-by: Andrew Morton <akpm@linux-foundation.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-fscrypt" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Biggers Jan. 25, 2018, 6:42 p.m. UTC | #2
On Fri, Jan 19, 2018 at 01:53:48PM -0800, Andrew Morton wrote:
> On Fri, 19 Jan 2018 13:45:24 -0800 Eric Biggers <ebiggers3@gmail.com> wrote:
> 
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > gcc versions prior to 4.6 require an extra level of braces when using a
> > designated initializer for a member in an anonymous struct or union.
> > This caused a compile error with the 'struct qstr' initialization in
> > __fscrypt_encrypt_symlink().
> > 
> > Fix it by using QSTR_INIT().
> > 
> > Reported-by: Andrew Morton <akpm@linux-foundation.org>
> > Fixes: 76e81d6d5048 ("fscrypt: new helper functions for ->symlink()")
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> 
> Tested-by: Andrew Morton <akpm@linux-foundation.org>

Ted, can you apply this to the fscrypt tree?
--
To unsubscribe from this list: send the line "unsubscribe linux-fscrypt" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Biggers Jan. 29, 2018, 6:10 p.m. UTC | #3
On Thu, Jan 25, 2018 at 10:42:29AM -0800, Eric Biggers wrote:
> On Fri, Jan 19, 2018 at 01:53:48PM -0800, Andrew Morton wrote:
> > On Fri, 19 Jan 2018 13:45:24 -0800 Eric Biggers <ebiggers3@gmail.com> wrote:
> > 
> > > From: Eric Biggers <ebiggers@google.com>
> > > 
> > > gcc versions prior to 4.6 require an extra level of braces when using a
> > > designated initializer for a member in an anonymous struct or union.
> > > This caused a compile error with the 'struct qstr' initialization in
> > > __fscrypt_encrypt_symlink().
> > > 
> > > Fix it by using QSTR_INIT().
> > > 
> > > Reported-by: Andrew Morton <akpm@linux-foundation.org>
> > > Fixes: 76e81d6d5048 ("fscrypt: new helper functions for ->symlink()")
> > > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > 
> > Tested-by: Andrew Morton <akpm@linux-foundation.org>
> 
> Ted, can you apply this to the fscrypt tree?

Ping.
--
To unsubscribe from this list: send the line "unsubscribe linux-fscrypt" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o Feb. 1, 2018, 3:52 p.m. UTC | #4
On Fri, Jan 19, 2018 at 01:45:24PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> gcc versions prior to 4.6 require an extra level of braces when using a
> designated initializer for a member in an anonymous struct or union.
> This caused a compile error with the 'struct qstr' initialization in
> __fscrypt_encrypt_symlink().
> 
> Fix it by using QSTR_INIT().
> 
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Fixes: 76e81d6d5048 ("fscrypt: new helper functions for ->symlink()")
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-fscrypt" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c
index 28f9f059571d..bec06490fb13 100644
--- a/fs/crypto/hooks.c
+++ b/fs/crypto/hooks.c
@@ -158,7 +158,7 @@  int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
 			      unsigned int len, struct fscrypt_str *disk_link)
 {
 	int err;
-	struct qstr iname = { .name = target, .len = len };
+	struct qstr iname = QSTR_INIT(target, len);
 	struct fscrypt_symlink_data *sd;
 	unsigned int ciphertext_len;