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


Groups > linux.kernel > #1317923 > unrolled thread

[PATCH v2 1/2] crypto: sunxi - don't print confusing data

Started byArnd Bergmann <arnd@arndb.de>
First post2016-01-26 14:50 +0100
Last post2016-01-27 20:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 1/2] crypto: sunxi - don't print confusing data Arnd Bergmann <arnd@arndb.de> - 2016-01-26 14:50 +0100
    Re: [PATCH v2 1/2] crypto: sunxi - don't print confusing data Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-27 15:20 +0100
    Re: [PATCH v2 1/2] crypto: sunxi - don't print confusing data Corentin LABBE <clabbe.montjoie@gmail.com> - 2016-01-27 20:50 +0100

#1317923 — [PATCH v2 1/2] crypto: sunxi - don't print confusing data

FromArnd Bergmann <arnd@arndb.de>
Date2016-01-26 14:50 +0100
Subject[PATCH v2 1/2] crypto: sunxi - don't print confusing data
Message-ID<qVcal-4P7-5@gated-at.bofh.it>
gcc correctly warns that the printk output contains a variable that
it thinks 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

A closer look at the function reveals that the variable is always
initialized at this point (ileft is guaranteed to be positive at the
start), but its contents are not well-defined:
Depending on some other variables, it might be either a count in
words or bytes, and it could refer to either input or output.

The easiest solution apparently is to remove the confusing output
and let the reader figure out the state from the other variables.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
index a19ee127edca..7be3fbcd8d78 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -251,11 +251,10 @@ static int sun4i_ss_cipher_poll(struct ablkcipher_request *areq)
 		spaces = readl(ss->base + SS_FCSR);
 		rx_cnt = SS_RXFIFO_SPACES(spaces);
 		tx_cnt = SS_TXFIFO_SPACES(spaces);
-		dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u %u\n",
+		dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
 			mode,
 			oi, mi.length, ileft, areq->nbytes, rx_cnt,
-			oo, mo.length, oleft, areq->nbytes, tx_cnt,
-			todo, ob);
+			oo, mo.length, oleft, areq->nbytes, tx_cnt, ob);
 
 		if (tx_cnt == 0)
 			continue;
-- 
2.7.0

[toc] | [next] | [standalone]


#1319005

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2016-01-27 15:20 +0100
Message-ID<qVz6X-4J4-29@gated-at.bofh.it>
In reply to#1317923
On Tue, Jan 26, 2016 at 02:44:50PM +0100, Arnd Bergmann wrote:
> gcc correctly warns that the printk output contains a variable that
> it thinks 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
> 
> A closer look at the function reveals that the variable is always
> initialized at this point (ileft is guaranteed to be positive at the
> start), but its contents are not well-defined:
> Depending on some other variables, it might be either a count in
> words or bytes, and it could refer to either input or output.
> 
> The easiest solution apparently is to remove the confusing output
> and let the reader figure out the state from the other variables.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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

[toc] | [prev] | [next] | [standalone]


#1319542

FromCorentin LABBE <clabbe.montjoie@gmail.com>
Date2016-01-27 20:50 +0100
Message-ID<qVEgj-6M-45@gated-at.bofh.it>
In reply to#1317923
Le 26/01/2016 14:44, Arnd Bergmann a écrit :
> gcc correctly warns that the printk output contains a variable that
> it thinks 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
> 
> A closer look at the function reveals that the variable is always
> initialized at this point (ileft is guaranteed to be positive at the
> start), but its contents are not well-defined:
> Depending on some other variables, it might be either a count in
> words or bytes, and it could refer to either input or output.
> 
> The easiest solution apparently is to remove the confusing output
> and let the reader figure out the state from the other variables.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
> index a19ee127edca..7be3fbcd8d78 100644
> --- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
> +++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
> @@ -251,11 +251,10 @@ static int sun4i_ss_cipher_poll(struct ablkcipher_request *areq)
>  		spaces = readl(ss->base + SS_FCSR);
>  		rx_cnt = SS_RXFIFO_SPACES(spaces);
>  		tx_cnt = SS_TXFIFO_SPACES(spaces);
> -		dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u %u\n",
> +		dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
>  			mode,
>  			oi, mi.length, ileft, areq->nbytes, rx_cnt,
> -			oo, mo.length, oleft, areq->nbytes, tx_cnt,
> -			todo, ob);
> +			oo, mo.length, oleft, areq->nbytes, tx_cnt, ob);
>  
>  		if (tx_cnt == 0)
>  			continue;
> 

Hello

A bit late but Acked-by: LABBE Corentin <clabbe.montjoie@gmail.com>

Thanks

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web