Commit beae2c9e authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds

crypto: aesni: shut up -Wmaybe-uninitialized warning

The rfc4106 encrypy/decrypt helper functions cause an annoying
false-positive warning in allmodconfig if we turn on
-Wmaybe-uninitialized warnings again:

  arch/x86/crypto/aesni-intel_glue.c: In function ‘helper_rfc4106_decrypt’:
  include/linux/scatterlist.h:67:31: warning: ‘dst_sg_walk.sg’ may be used uninitialized in this function [-Wmaybe-uninitialized]

The problem seems to be that the compiler doesn't track the state of the
'one_entry_in_sg' variable across the kernel_fpu_begin/kernel_fpu_end
section.

This takes the easy way out by adding a bogus initialization, which
should be harmless enough to get the patch into v4.9 so we can turn on
this warning again by default without producing useless output.  A
follow-up patch for v4.10 rearranges the code to make the warning go
away.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9cdbe14f
...@@ -888,7 +888,7 @@ static int helper_rfc4106_encrypt(struct aead_request *req) ...@@ -888,7 +888,7 @@ static int helper_rfc4106_encrypt(struct aead_request *req)
unsigned long auth_tag_len = crypto_aead_authsize(tfm); unsigned long auth_tag_len = crypto_aead_authsize(tfm);
u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
struct scatter_walk src_sg_walk; struct scatter_walk src_sg_walk;
struct scatter_walk dst_sg_walk; struct scatter_walk dst_sg_walk = {};
unsigned int i; unsigned int i;
/* Assuming we are supporting rfc4106 64-bit extended */ /* Assuming we are supporting rfc4106 64-bit extended */
...@@ -968,7 +968,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req) ...@@ -968,7 +968,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req)
u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
u8 authTag[16]; u8 authTag[16];
struct scatter_walk src_sg_walk; struct scatter_walk src_sg_walk;
struct scatter_walk dst_sg_walk; struct scatter_walk dst_sg_walk = {};
unsigned int i; unsigned int i;
if (unlikely(req->assoclen != 16 && req->assoclen != 20)) if (unlikely(req->assoclen != 16 && req->assoclen != 20))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment