@@ -1204,6 +1204,7 @@ static int AesGcmCrypt_1(struct aead_request *req, int decrypt_p, int rfc4106_p)
12041204 pr_err ("%s: scatterwalk_map failed: %ld\n" ,
12051205 crypto_tfm_alg_driver_name (crypto_aead_tfm (tfm )),
12061206 PTR_ERR (assoc ));
1207+ in_map = NULL ;
12071208 goto out ;
12081209 }
12091210 assoc = in_map ;
@@ -1220,6 +1221,7 @@ static int AesGcmCrypt_1(struct aead_request *req, int decrypt_p, int rfc4106_p)
12201221 pr_err ("%s: scatterwalk_map failed: %ld\n" ,
12211222 crypto_tfm_alg_driver_name (crypto_aead_tfm (tfm )),
12221223 PTR_ERR (assoc ));
1224+ out_map = NULL ;
12231225 goto out ;
12241226 }
12251227 out_text = out_map + req -> assoclen ;
@@ -2329,6 +2331,7 @@ static int linuxkm_test_aescbc(void)
23292331 if (IS_ERR (tfm )) {
23302332 pr_err ("error: allocating AES skcipher algorithm %s failed: %ld\n" ,
23312333 WOLFKM_AESCBC_DRIVER , PTR_ERR (tfm ));
2334+ tfm = NULL ;
23322335 goto test_cbc_end ;
23332336 }
23342337
@@ -2355,6 +2358,7 @@ static int linuxkm_test_aescbc(void)
23552358 if (IS_ERR (req )) {
23562359 pr_err ("error: allocating AES skcipher request %s failed\n" ,
23572360 WOLFKM_AESCBC_DRIVER );
2361+ req = NULL ;
23582362 goto test_cbc_end ;
23592363 }
23602364
@@ -2538,6 +2542,7 @@ static int linuxkm_test_aescfb(void)
25382542 if (IS_ERR (tfm )) {
25392543 pr_err ("error: allocating AES skcipher algorithm %s failed: %ld\n" ,
25402544 WOLFKM_AESCFB_DRIVER , PTR_ERR (tfm ));
2545+ tfm = NULL ;
25412546 goto test_cfb_end ;
25422547 }
25432548
@@ -2555,6 +2560,7 @@ static int linuxkm_test_aescfb(void)
25552560 if (IS_ERR (req )) {
25562561 pr_err ("error: allocating AES skcipher request %s failed\n" ,
25572562 WOLFKM_AESCFB_DRIVER );
2563+ req = NULL ;
25582564 goto test_cfb_end ;
25592565 }
25602566
@@ -2763,6 +2769,7 @@ static int linuxkm_test_aesgcm(void)
27632769 assoc2 = malloc (sizeof (assoc ));
27642770 if (IS_ERR (assoc2 )) {
27652771 pr_err ("error: malloc failed\n" );
2772+ assoc2 = NULL ;
27662773 goto test_gcm_end ;
27672774 }
27682775 memset (assoc2 , 0 , sizeof (assoc ));
@@ -2771,6 +2778,7 @@ static int linuxkm_test_aesgcm(void)
27712778 iv = malloc (WC_AES_BLOCK_SIZE );
27722779 if (IS_ERR (iv )) {
27732780 pr_err ("error: malloc failed\n" );
2781+ iv = NULL ;
27742782 goto test_gcm_end ;
27752783 }
27762784 memset (iv , 0 , WC_AES_BLOCK_SIZE );
@@ -2779,12 +2787,14 @@ static int linuxkm_test_aesgcm(void)
27792787 enc2 = malloc (decryptLen );
27802788 if (IS_ERR (enc2 )) {
27812789 pr_err ("error: malloc failed\n" );
2790+ enc2 = NULL ;
27822791 goto test_gcm_end ;
27832792 }
27842793
27852794 dec2 = malloc (decryptLen );
27862795 if (IS_ERR (dec2 )) {
27872796 pr_err ("error: malloc failed\n" );
2797+ dec2 = NULL ;
27882798 goto test_gcm_end ;
27892799 }
27902800
@@ -2796,6 +2806,7 @@ static int linuxkm_test_aesgcm(void)
27962806 if (IS_ERR (tfm )) {
27972807 pr_err ("error: allocating AES skcipher algorithm %s failed: %ld\n" ,
27982808 WOLFKM_AESGCM_DRIVER , PTR_ERR (tfm ));
2809+ tfm = NULL ;
27992810 goto test_gcm_end ;
28002811 }
28012812
@@ -2819,15 +2830,25 @@ static int linuxkm_test_aesgcm(void)
28192830 if (IS_ERR (req )) {
28202831 pr_err ("error: allocating AES aead request %s failed: %ld\n" ,
28212832 WOLFKM_AESCBC_DRIVER , PTR_ERR (req ));
2833+ req = NULL ;
28222834 goto test_gcm_end ;
28232835 }
28242836
28252837 src = malloc (sizeof (struct scatterlist ) * 2 );
2838+
2839+ if (IS_ERR (src )) {
2840+ pr_err ("error: malloc src failed: %ld\n" ,
2841+ PTR_ERR (src ));
2842+ src = NULL ;
2843+ goto test_gcm_end ;
2844+ }
2845+
28262846 dst = malloc (sizeof (struct scatterlist ) * 2 );
28272847
2828- if (IS_ERR (src ) || IS_ERR (dst )) {
2829- pr_err ("error: malloc src or dst failed: %ld, %ld\n" ,
2830- PTR_ERR (src ), PTR_ERR (dst ));
2848+ if (IS_ERR (dst )) {
2849+ pr_err ("error: malloc dst failed: %ld\n" ,
2850+ PTR_ERR (dst ));
2851+ dst = NULL ;
28312852 goto test_gcm_end ;
28322853 }
28332854
@@ -3367,6 +3388,7 @@ static int aes_xts_128_test(void)
33673388 ret = PTR_ERR (tfm );
33683389 pr_err ("error: allocating AES skcipher algorithm %s failed: %d\n" ,
33693390 WOLFKM_AESXTS_DRIVER , ret );
3391+ tfm = NULL ;
33703392 goto test_xts_end ;
33713393 }
33723394
@@ -3404,6 +3426,7 @@ static int aes_xts_128_test(void)
34043426 ret = PTR_ERR (req );
34053427 pr_err ("error: allocating AES skcipher request %s failed: %d\n" ,
34063428 WOLFKM_AESXTS_DRIVER , ret );
3429+ req = NULL ;
34073430 goto test_xts_end ;
34083431 }
34093432
@@ -3847,6 +3870,7 @@ static int aes_xts_256_test(void)
38473870 ret = PTR_ERR (tfm );
38483871 pr_err ("error: allocating AES skcipher algorithm %s failed: %d\n" ,
38493872 WOLFKM_AESXTS_DRIVER , ret );
3873+ tfm = NULL ;
38503874 goto test_xts_end ;
38513875 }
38523876
@@ -3883,6 +3907,7 @@ static int aes_xts_256_test(void)
38833907 ret = PTR_ERR (req );
38843908 pr_err ("error: allocating AES skcipher request %s failed: %d\n" ,
38853909 WOLFKM_AESXTS_DRIVER , ret );
3910+ req = NULL ;
38863911 goto test_xts_end ;
38873912 }
38883913
0 commit comments