Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1519143

[PATCH v2 08/11] crypto: aesni: shut up -Wmaybe-uninitialized warning

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH v2 08/11] crypto: aesni: shut up -Wmaybe-uninitialized warning
Date 2016-11-10 17:50 +0100
Message-ID <sC0I2-h7-37@gated-at.bofh.it> (permalink)
References <sC0I2-h7-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/crypto/aesni-intel_glue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 0ab5ee1..aa8b067 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -888,7 +888,7 @@ static int helper_rfc4106_encrypt(struct aead_request *req)
 	unsigned long auth_tag_len = crypto_aead_authsize(tfm);
 	u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
 	struct scatter_walk src_sg_walk;
-	struct scatter_walk dst_sg_walk;
+	struct scatter_walk dst_sg_walk = {};
 	unsigned int i;
 
 	/* Assuming we are supporting rfc4106 64-bit extended */
@@ -968,7 +968,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req)
 	u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
 	u8 authTag[16];
 	struct scatter_walk src_sg_walk;
-	struct scatter_walk dst_sg_walk;
+	struct scatter_walk dst_sg_walk = {};
 	unsigned int i;
 
 	if (unlikely(req->assoclen != 16 && req->assoclen != 20))
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 01/11] Kbuild: enable -Wmaybe-uninitialized warning for "make W=1" Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 06/11] [media] dib0700: fix nec repeat handling Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 10/11] pcmcia: fix return value of soc_pcmcia_regulator_set Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 07/11] [media] rc: print correct variable for z8f0811 Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 08/11] crypto: aesni: shut up -Wmaybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 11/11] Kbuild: enable -Wmaybe-uninitialized warnings by default Arnd Bergmann <arnd@arndb.de> - 2016-11-10 17:50 +0100
  [PATCH v2 09/11] [v3] infiniband: shut up a maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-11-10 18:00 +0100
  [PATCH v2 03/11] x86: apm: avoid uninitialized data Arnd Bergmann <arnd@arndb.de> - 2016-11-10 18:00 +0100
  Re: [PATCH v2 00/11] getting back -Wmaybe-uninitialized Linus Torvalds <torvalds@linux-foundation.org> - 2016-11-11 18:20 +0100
    Re: [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann <arnd@arndb.de> - 2016-11-11 21:00 +0100

csiph-web