Skip to content

Commit

Permalink
tipc: fix update of the uninitialized variable err
Browse files Browse the repository at this point in the history
Variable err is not uninitialized and hence can potentially contain
any garbage value.  This may cause an error when logical or'ing the
return values from the calls to functions crypto_aead_setauthsize or
crypto_aead_setkey.  Fix this by setting err to the return of
crypto_aead_setauthsize rather than or'ing in the return into the
uninitialized variable

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: fc1b6d6 ("tipc: introduce TIPC encryption & authentication")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Colin Ian King authored and David S. Miller committed Nov 12, 2019
1 parent 59618bc commit c33fdc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tipc/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ static int tipc_aead_init(struct tipc_aead **aead, struct tipc_aead_key *ukey,
break;
}

err |= crypto_aead_setauthsize(tfm, TIPC_AES_GCM_TAG_SIZE);
err = crypto_aead_setauthsize(tfm, TIPC_AES_GCM_TAG_SIZE);
err |= crypto_aead_setkey(tfm, ukey->key, keylen);
if (unlikely(err)) {
crypto_free_aead(tfm);
Expand Down

0 comments on commit c33fdc3

Please sign in to comment.