Re: linux-next: build warning after merge of the crypto tree

From: Gary R Hook
Date: Mon Jul 31 2017 - 09:51:18 EST


On 07/30/2017 09:17 PM, Stephen Rothwell wrote:
Hi Herbert,

After merging the crypto tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

drivers/crypto/ccp/ccp-ops.c: In function 'ccp_run_rsa_cmd':
drivers/crypto/ccp/ccp-ops.c:1856:3: warning: 'sb_count' may be used uninitialized in this function [-Wmaybe-uninitialized]
cmd_q->ccp->vdata->perform->sbfree(cmd_q, op.sb_key, sb_count);
^

Maybe introduced by commit

6ba46c7d4d7e ("crypto: ccp - Fix base RSA function for version 5 CCPs")


Actually, it's been this way for a while: 956ee21 should be the commit that introduced the spurious warning.

If you can explain to me a way to get the compiler to either (a) be smarter, or (b) shut up about this, I'd like to hear it. I see this with gcc 4.8/4.9/50.

IMO the compiler is incorrect. The code path where the variable is used is complete, and the path where it is unused is complete. I don't see a way for a logic error (and thus, use an uninitialized variable) to occur.

If someone can enlighten me, I'd appreciate it. Or, I can change the code to recompute the value when it's needed.