MLK-20204: drivers: crypto: caam: sm: test: Dealloc keyslot properly
authorFranck LENORMAND <franck.lenormand@nxp.com>
Fri, 23 Nov 2018 10:47:18 +0000 (11:47 +0100)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
commit1d749430cb6386c7faea0c340d71219dc63808d5
tree058e66e5d2b9ea70429e1001f4afe0cf115b2c40
parentb7385ab947848a7d4265e737ed188467d618c60b
MLK-20204: drivers: crypto: caam: sm: test: Dealloc keyslot properly

Some keyslot values were used during deallocation
but were not initiliazed nor set properly.

drivers/crypto/caam/sm_test.c:446: CID 3901091 (#1 of 1):
  Type: Uninitialized scalar variable (UNINIT)
  Classification: Unclassified
  Severity: Unspecified
  Action: Modeling Required
  Owner: nxa21133
  Defect only exists locally.
drivers/crypto/caam/sm_test.c:98:
  1. var_decl: Declaring variable "keyslot24" without initializer.
drivers/crypto/caam/sm_test.c:113:
  2. path: Condition "!ctrlpriv", taking false branch.
drivers/crypto/caam/sm_test.c:118:
  3. path: Condition "kspriv == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:123:
  4. path: Condition "!units", taking false branch.
drivers/crypto/caam/sm_test.c:130:
  5. path: Condition "units < 2", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  6. path: Condition "blob8 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  7. path: Condition "blob16 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  8. path: Condition "blob24 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  9. path: Condition "blob32 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:178:
  10. path: Condition "sm_keystore_slot_alloc(ksdev, unit,
  (16U /* (8 % 16) ? (8 >> 4) + 1 << 4 : 8 */), &keyslot8)", taking true
  branch.
drivers/crypto/caam/sm_test.c:179:
  11. path: Jumping to label "dealloc".
drivers/crypto/caam/sm_test.c:446:
  12. uninit_use_in_call: Using uninitialized value "keyslot24" when
  calling "sm_keystore_slot_dealloc".
drivers/crypto/caam/sm_store.c:771:
  12.1. path: Condition "smpriv->slot_alloc == NULL", taking false branch.
drivers/crypto/caam/sm_store.c:771:
  12.2. path: Condition "smpriv->pagedesc[unit].ksdata == NULL", taking
  false branch.
drivers/crypto/caam/sm_store.c:775:
  12.3. read_parm: Reading a parameter value.

drivers/crypto/caam/sm_test.c:445: CID 3901093 (#1 of 1):
  Type: Uninitialized scalar variable (UNINIT)
  Classification: Unclassified
  Severity: Unspecified
  Action: Modeling Required
  Owner: nxa21133
  Defect only exists locally.
drivers/crypto/caam/sm_test.c:98:
  1. var_decl: Declaring variable "keyslot16" without initializer.
drivers/crypto/caam/sm_test.c:113:
  2. path: Condition "!ctrlpriv", taking false branch.
drivers/crypto/caam/sm_test.c:118:
  3. path: Condition "kspriv == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:123:
  4. path: Condition "!units", taking false branch.
drivers/crypto/caam/sm_test.c:130:
  5. path: Condition "units < 2", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  6. path: Condition "blob8 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  7. path: Condition "blob16 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  8. path: Condition "blob24 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:150:
  9. path: Condition "blob32 == NULL", taking false branch.
drivers/crypto/caam/sm_test.c:178:
  10. path: Condition "sm_keystore_slot_alloc(ksdev, unit,
  (16U /* (8 % 16) ? (8 >> 4) + 1 << 4 : 8 */), &keyslot8)", taking true
  branch.
drivers/crypto/caam/sm_test.c:179:
  11. path: Jumping to label "dealloc".
drivers/crypto/caam/sm_test.c:445:
  12. uninit_use_in_call: Using uninitialized value "keyslot16" when
  calling "sm_keystore_slot_dealloc".
drivers/crypto/caam/sm_store.c:771:
  12.1. path: Condition "smpriv->slot_alloc == NULL", taking false branch.
drivers/crypto/caam/sm_store.c:771:
  12.2. path: Condition "smpriv->pagedesc[unit].ksdata == NULL", taking
  false branch.
drivers/crypto/caam/sm_store.c:775:
  12.3. read_parm: Reading a parameter value.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
drivers/crypto/caam/sm_test.c