mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-09-03 10:33:11 +02:00
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>
This commit is contained in:
parent
b7385ab947
commit
1d749430cb
|
@ -176,16 +176,16 @@ int caam_sm_example_init(struct platform_device *pdev)
|
|||
* so pad them out.
|
||||
*/
|
||||
if (sm_keystore_slot_alloc(ksdev, unit, AES_BLOCK_PAD(8), &keyslot8))
|
||||
goto dealloc;
|
||||
goto freemem;
|
||||
|
||||
if (sm_keystore_slot_alloc(ksdev, unit, AES_BLOCK_PAD(16), &keyslot16))
|
||||
goto dealloc;
|
||||
goto dealloc_slot8;
|
||||
|
||||
if (sm_keystore_slot_alloc(ksdev, unit, AES_BLOCK_PAD(24), &keyslot24))
|
||||
goto dealloc;
|
||||
goto dealloc_slot16;
|
||||
|
||||
if (sm_keystore_slot_alloc(ksdev, unit, AES_BLOCK_PAD(32), &keyslot32))
|
||||
goto dealloc;
|
||||
goto dealloc_slot24;
|
||||
|
||||
|
||||
/* Now load clear key data into the newly allocated slots */
|
||||
|
@ -441,11 +441,13 @@ int caam_sm_example_init(struct platform_device *pdev)
|
|||
|
||||
/* Remove keys from keystore */
|
||||
dealloc:
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot8);
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot16);
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot24);
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot32);
|
||||
|
||||
dealloc_slot24:
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot24);
|
||||
dealloc_slot16:
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot16);
|
||||
dealloc_slot8:
|
||||
sm_keystore_slot_dealloc(ksdev, unit, keyslot8);
|
||||
|
||||
/* Free resources */
|
||||
freemem:
|
||||
|
|
Loading…
Reference in New Issue
Block a user