diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-07-31 16:49:21 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-08-09 08:17:58 -0400 |
commit | d634baea628af60d20a82db911b9dc99a5f16244 (patch) | |
tree | 46784a86859a79882f4f7fd764ae9cc0c108b081 | |
parent | c871c10e4ea763e76e30f6ecb64dc9938ae2e6b9 (diff) |
crypto: ccp - avoid uninitialized variable warning
The added support for version 5 CCPs introduced a false-positive
warning in the RSA implementation:
drivers/crypto/ccp/ccp-ops.c: In function 'ccp_run_rsa_cmd':
drivers/crypto/ccp/ccp-ops.c:1856:3: error: 'sb_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This changes the code in a way that should make it easier for
the compiler to track the state of the sb_count variable, and
avoid the warning.
Fixes: 6ba46c7d4d7e ("crypto: ccp - Fix base RSA function for version 5 CCPs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/ccp/ccp-ops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index cc16cb0fc3af..804924e48c89 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c | |||
@@ -1785,6 +1785,7 @@ static int ccp_run_rsa_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) | |||
1785 | o_len = 32 * ((rsa->key_size + 255) / 256); | 1785 | o_len = 32 * ((rsa->key_size + 255) / 256); |
1786 | i_len = o_len * 2; | 1786 | i_len = o_len * 2; |
1787 | 1787 | ||
1788 | sb_count = 0; | ||
1788 | if (cmd_q->ccp->vdata->version < CCP_VERSION(5, 0)) { | 1789 | if (cmd_q->ccp->vdata->version < CCP_VERSION(5, 0)) { |
1789 | /* sb_count is the number of storage block slots required | 1790 | /* sb_count is the number of storage block slots required |
1790 | * for the modulus. | 1791 | * for the modulus. |
@@ -1879,7 +1880,7 @@ e_exp: | |||
1879 | ccp_dm_free(&exp); | 1880 | ccp_dm_free(&exp); |
1880 | 1881 | ||
1881 | e_sb: | 1882 | e_sb: |
1882 | if (cmd_q->ccp->vdata->version < CCP_VERSION(5, 0)) | 1883 | if (sb_count) |
1883 | cmd_q->ccp->vdata->perform->sbfree(cmd_q, op.sb_key, sb_count); | 1884 | cmd_q->ccp->vdata->perform->sbfree(cmd_q, op.sb_key, sb_count); |
1884 | 1885 | ||
1885 | return ret; | 1886 | return ret; |