@@ -701,19 +701,17 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb,
701
701
int err ;
702
702
703
703
algt = crypto_get_attr_type (tb );
704
- err = PTR_ERR (algt );
705
704
if (IS_ERR (algt ))
706
- return ERR_PTR ( err );
705
+ return ERR_CAST ( algt );
707
706
708
707
if ((algt -> type ^ CRYPTO_ALG_TYPE_AEAD ) & algt -> mask )
709
708
return ERR_PTR (- EINVAL );
710
709
711
710
ghash_alg = crypto_find_alg (ghash_name , & crypto_ahash_type ,
712
711
CRYPTO_ALG_TYPE_HASH ,
713
712
CRYPTO_ALG_TYPE_AHASH_MASK );
714
- err = PTR_ERR (ghash_alg );
715
713
if (IS_ERR (ghash_alg ))
716
- return ERR_PTR ( err );
714
+ return ERR_CAST ( ghash_alg );
717
715
718
716
err = - ENOMEM ;
719
717
inst = kzalloc (sizeof (* inst ) + sizeof (* ctx ), GFP_KERNEL );
@@ -787,15 +785,13 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb,
787
785
788
786
static struct crypto_instance * crypto_gcm_alloc (struct rtattr * * tb )
789
787
{
790
- int err ;
791
788
const char * cipher_name ;
792
789
char ctr_name [CRYPTO_MAX_ALG_NAME ];
793
790
char full_name [CRYPTO_MAX_ALG_NAME ];
794
791
795
792
cipher_name = crypto_attr_alg_name (tb [1 ]);
796
- err = PTR_ERR (cipher_name );
797
793
if (IS_ERR (cipher_name ))
798
- return ERR_PTR ( err );
794
+ return ERR_CAST ( cipher_name );
799
795
800
796
if (snprintf (ctr_name , CRYPTO_MAX_ALG_NAME , "ctr(%s)" , cipher_name ) >=
801
797
CRYPTO_MAX_ALG_NAME )
@@ -826,20 +822,17 @@ static struct crypto_template crypto_gcm_tmpl = {
826
822
827
823
static struct crypto_instance * crypto_gcm_base_alloc (struct rtattr * * tb )
828
824
{
829
- int err ;
830
825
const char * ctr_name ;
831
826
const char * ghash_name ;
832
827
char full_name [CRYPTO_MAX_ALG_NAME ];
833
828
834
829
ctr_name = crypto_attr_alg_name (tb [1 ]);
835
- err = PTR_ERR (ctr_name );
836
830
if (IS_ERR (ctr_name ))
837
- return ERR_PTR ( err );
831
+ return ERR_CAST ( ctr_name );
838
832
839
833
ghash_name = crypto_attr_alg_name (tb [2 ]);
840
- err = PTR_ERR (ghash_name );
841
834
if (IS_ERR (ghash_name ))
842
- return ERR_PTR ( err );
835
+ return ERR_CAST ( ghash_name );
843
836
844
837
if (snprintf (full_name , CRYPTO_MAX_ALG_NAME , "gcm_base(%s,%s)" ,
845
838
ctr_name , ghash_name ) >= CRYPTO_MAX_ALG_NAME )
@@ -971,17 +964,15 @@ static struct crypto_instance *crypto_rfc4106_alloc(struct rtattr **tb)
971
964
int err ;
972
965
973
966
algt = crypto_get_attr_type (tb );
974
- err = PTR_ERR (algt );
975
967
if (IS_ERR (algt ))
976
- return ERR_PTR ( err );
968
+ return ERR_CAST ( algt );
977
969
978
970
if ((algt -> type ^ CRYPTO_ALG_TYPE_AEAD ) & algt -> mask )
979
971
return ERR_PTR (- EINVAL );
980
972
981
973
ccm_name = crypto_attr_alg_name (tb [1 ]);
982
- err = PTR_ERR (ccm_name );
983
974
if (IS_ERR (ccm_name ))
984
- return ERR_PTR ( err );
975
+ return ERR_CAST ( ccm_name );
985
976
986
977
inst = kzalloc (sizeof (* inst ) + sizeof (* spawn ), GFP_KERNEL );
987
978
if (!inst )
@@ -1222,17 +1213,15 @@ static struct crypto_instance *crypto_rfc4543_alloc(struct rtattr **tb)
1222
1213
int err ;
1223
1214
1224
1215
algt = crypto_get_attr_type (tb );
1225
- err = PTR_ERR (algt );
1226
1216
if (IS_ERR (algt ))
1227
- return ERR_PTR ( err );
1217
+ return ERR_CAST ( algt );
1228
1218
1229
1219
if ((algt -> type ^ CRYPTO_ALG_TYPE_AEAD ) & algt -> mask )
1230
1220
return ERR_PTR (- EINVAL );
1231
1221
1232
1222
ccm_name = crypto_attr_alg_name (tb [1 ]);
1233
- err = PTR_ERR (ccm_name );
1234
1223
if (IS_ERR (ccm_name ))
1235
- return ERR_PTR ( err );
1224
+ return ERR_CAST ( ccm_name );
1236
1225
1237
1226
inst = kzalloc (sizeof (* inst ) + sizeof (* spawn ), GFP_KERNEL );
1238
1227
if (!inst )
0 commit comments