public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: herbert@gondor.apana.org.au (Herbert Xu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] crypto: sunxi - don't print uninitialized data
Date: Tue, 26 Jan 2016 18:44:27 +0800	[thread overview]
Message-ID: <20160126104427.GA19583@gondor.apana.org.au> (raw)
In-Reply-To: <1453740845-1980433-1-git-send-email-arnd@arndb.de>

On Mon, Jan 25, 2016 at 05:53:48PM +0100, Arnd Bergmann wrote:
> gcc correctly warns that the printk output contains a variable that
> is not initialized in some cases:
> 
> drivers/crypto/sunxi-ss/sun4i-ss-cipher.c: In function 'sun4i_ss_cipher_poll':
> drivers/crypto/sunxi-ss/sun4i-ss-cipher.c:254:76: warning: 'todo' may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/crypto/sunxi-ss/sun4i-ss-cipher.c:144:15: note: 'todo' was declared here
> 
> This adds an explicit initialization to zero in the exact case where it
> was missing, to avoid leaking stack data to the console and to shut up
> that warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

This is actually a bogus warning because todo is always initialised
but gcc can't see that because it's behind multiple conditionals.

It would be great if we can restructure the code so that gcc can see
this while at the same time also improving the readability of the
loop.

Otherwise just initialise it at the top or use uninitialised_var.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      parent reply	other threads:[~2016-01-26 10:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 16:53 [PATCH 1/4] crypto: sunxi - don't print uninitialized data Arnd Bergmann
2016-01-25 16:56 ` Arnd Bergmann
2016-01-26 10:44 ` Herbert Xu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160126104427.GA19583@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox