@@ -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
@@ -2761,29 +2767,29 @@ static int linuxkm_test_aesgcm(void)
27612767
27622768 /* now the kernel crypto part */
27632769 assoc2 = malloc (sizeof (assoc ));
2764- if (IS_ERR ( assoc2 ) ) {
2770+ if (! assoc2 ) {
27652771 pr_err ("error: malloc failed\n" );
27662772 goto test_gcm_end ;
27672773 }
27682774 memset (assoc2 , 0 , sizeof (assoc ));
27692775 memcpy (assoc2 , assoc , sizeof (assoc ));
27702776
27712777 iv = malloc (WC_AES_BLOCK_SIZE );
2772- if (IS_ERR ( iv ) ) {
2778+ if (! iv ) {
27732779 pr_err ("error: malloc failed\n" );
27742780 goto test_gcm_end ;
27752781 }
27762782 memset (iv , 0 , WC_AES_BLOCK_SIZE );
27772783 memcpy (iv , ivstr , GCM_NONCE_MID_SZ );
27782784
27792785 enc2 = malloc (decryptLen );
2780- if (IS_ERR ( enc2 ) ) {
2786+ if (! enc2 ) {
27812787 pr_err ("error: malloc failed\n" );
27822788 goto test_gcm_end ;
27832789 }
27842790
27852791 dec2 = malloc (decryptLen );
2786- if (IS_ERR ( dec2 ) ) {
2792+ if (! dec2 ) {
27872793 pr_err ("error: malloc failed\n" );
27882794 goto test_gcm_end ;
27892795 }
@@ -2796,6 +2802,7 @@ static int linuxkm_test_aesgcm(void)
27962802 if (IS_ERR (tfm )) {
27972803 pr_err ("error: allocating AES skcipher algorithm %s failed: %ld\n" ,
27982804 WOLFKM_AESGCM_DRIVER , PTR_ERR (tfm ));
2805+ tfm = NULL ;
27992806 goto test_gcm_end ;
28002807 }
28012808
@@ -2819,15 +2826,23 @@ static int linuxkm_test_aesgcm(void)
28192826 if (IS_ERR (req )) {
28202827 pr_err ("error: allocating AES aead request %s failed: %ld\n" ,
28212828 WOLFKM_AESCBC_DRIVER , PTR_ERR (req ));
2829+ req = NULL ;
28222830 goto test_gcm_end ;
28232831 }
28242832
28252833 src = malloc (sizeof (struct scatterlist ) * 2 );
2834+
2835+ if (! src ) {
2836+ pr_err ("error: malloc src failed: %ld\n" ,
2837+ PTR_ERR (src ));
2838+ goto test_gcm_end ;
2839+ }
2840+
28262841 dst = malloc (sizeof (struct scatterlist ) * 2 );
28272842
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 ));
2843+ if (! dst ) {
2844+ pr_err ("error: malloc dst failed: %ld\n" ,
2845+ PTR_ERR (dst ));
28312846 goto test_gcm_end ;
28322847 }
28332848
@@ -3367,6 +3382,7 @@ static int aes_xts_128_test(void)
33673382 ret = PTR_ERR (tfm );
33683383 pr_err ("error: allocating AES skcipher algorithm %s failed: %d\n" ,
33693384 WOLFKM_AESXTS_DRIVER , ret );
3385+ tfm = NULL ;
33703386 goto test_xts_end ;
33713387 }
33723388
@@ -3404,6 +3420,7 @@ static int aes_xts_128_test(void)
34043420 ret = PTR_ERR (req );
34053421 pr_err ("error: allocating AES skcipher request %s failed: %d\n" ,
34063422 WOLFKM_AESXTS_DRIVER , ret );
3423+ req = NULL ;
34073424 goto test_xts_end ;
34083425 }
34093426
@@ -3847,6 +3864,7 @@ static int aes_xts_256_test(void)
38473864 ret = PTR_ERR (tfm );
38483865 pr_err ("error: allocating AES skcipher algorithm %s failed: %d\n" ,
38493866 WOLFKM_AESXTS_DRIVER , ret );
3867+ tfm = NULL ;
38503868 goto test_xts_end ;
38513869 }
38523870
@@ -3883,6 +3901,7 @@ static int aes_xts_256_test(void)
38833901 ret = PTR_ERR (req );
38843902 pr_err ("error: allocating AES skcipher request %s failed: %d\n" ,
38853903 WOLFKM_AESXTS_DRIVER , ret );
3904+ req = NULL ;
38863905 goto test_xts_end ;
38873906 }
38883907
0 commit comments