Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit b4375617 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Alexander Alexeev
Browse files

security: keys: fix maybe-uninitialized warnings



security/keys/encrypted-keys/encrypted.c: In function 'encrypted_read':
security/keys/encrypted-keys/encrypted.c:922:6: warning: 'master_keylen' may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = get_derived_key(derived_key, ENC_KEY, master_key, master_keylen);
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
security/keys/encrypted-keys/encrypted.c:922:6: warning: 'master_key' may be used uninitialized in this function [-Wmaybe-uninitialized]
security/keys/encrypted-keys/encrypted.c: In function 'encrypted_instantiate':
security/keys/encrypted-keys/encrypted.c:688:6: warning: 'master_keylen' may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = datablob_hmac_verify(epayload, format, master_key, master_keylen);
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
security/keys/encrypted-keys/encrypted.c:660:9: note: 'master_keylen' was declared here
  size_t master_keylen;
         ^~~~~~~~~~~~~
security/keys/encrypted-keys/encrypted.c:688:6: warning: 'master_key' may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = datablob_hmac_verify(epayload, format, master_key, master_keylen);
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
security/keys/encrypted-keys/encrypted.c:656:6: note: 'master_key' was declared here
  u8 *master_key;
      ^~~~~~~~~~

A null pointer is handled properly by the code in this case. size_t should be initialized to 0.

Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
parent ba609554
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment