diff options
-rw-r--r-- | crypto/aead.c | 6 | ||||
-rw-r--r-- | crypto/algapi.c | 4 | ||||
-rw-r--r-- | crypto/authenc.c | 3 | ||||
-rw-r--r-- | crypto/authencesn.c | 3 | ||||
-rw-r--r-- | crypto/blkcipher.c | 6 | ||||
-rw-r--r-- | crypto/ccm.c | 23 | ||||
-rw-r--r-- | crypto/chainiv.c | 3 | ||||
-rw-r--r-- | crypto/ctr.c | 3 | ||||
-rw-r--r-- | crypto/cts.c | 3 | ||||
-rw-r--r-- | crypto/gcm.c | 29 | ||||
-rw-r--r-- | crypto/seqiv.c | 3 |
11 files changed, 27 insertions, 59 deletions
diff --git a/crypto/aead.c b/crypto/aead.c index 0b8121ebec07..4d04e12ffde8 100644 --- a/crypto/aead.c +++ b/crypto/aead.c | |||
@@ -282,18 +282,16 @@ struct crypto_instance *aead_geniv_alloc(struct crypto_template *tmpl, | |||
282 | int err; | 282 | int err; |
283 | 283 | ||
284 | algt = crypto_get_attr_type(tb); | 284 | algt = crypto_get_attr_type(tb); |
285 | err = PTR_ERR(algt); | ||
286 | if (IS_ERR(algt)) | 285 | if (IS_ERR(algt)) |
287 | return ERR_PTR(err); | 286 | return ERR_CAST(algt); |
288 | 287 | ||
289 | if ((algt->type ^ (CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_GENIV)) & | 288 | if ((algt->type ^ (CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_GENIV)) & |
290 | algt->mask) | 289 | algt->mask) |
291 | return ERR_PTR(-EINVAL); | 290 | return ERR_PTR(-EINVAL); |
292 | 291 | ||
293 | name = crypto_attr_alg_name(tb[1]); | 292 | name = crypto_attr_alg_name(tb[1]); |
294 | err = PTR_ERR(name); | ||
295 | if (IS_ERR(name)) | 293 | if (IS_ERR(name)) |
296 | return ERR_PTR(err); | 294 | return ERR_CAST(name); |
297 | 295 | ||
298 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); | 296 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); |
299 | if (!inst) | 297 | if (!inst) |
diff --git a/crypto/algapi.c b/crypto/algapi.c index c3b9bfeeb7ff..08c57c8aec95 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -749,12 +749,10 @@ struct crypto_alg *crypto_attr_alg2(struct rtattr *rta, | |||
749 | u32 type, u32 mask) | 749 | u32 type, u32 mask) |
750 | { | 750 | { |
751 | const char *name; | 751 | const char *name; |
752 | int err; | ||
753 | 752 | ||
754 | name = crypto_attr_alg_name(rta); | 753 | name = crypto_attr_alg_name(rta); |
755 | err = PTR_ERR(name); | ||
756 | if (IS_ERR(name)) | 754 | if (IS_ERR(name)) |
757 | return ERR_PTR(err); | 755 | return ERR_CAST(name); |
758 | 756 | ||
759 | return crypto_find_alg(name, frontend, type, mask); | 757 | return crypto_find_alg(name, frontend, type, mask); |
760 | } | 758 | } |
diff --git a/crypto/authenc.c b/crypto/authenc.c index d0583a4489e6..ffce19de05cf 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
@@ -592,9 +592,8 @@ static struct crypto_instance *crypto_authenc_alloc(struct rtattr **tb) | |||
592 | int err; | 592 | int err; |
593 | 593 | ||
594 | algt = crypto_get_attr_type(tb); | 594 | algt = crypto_get_attr_type(tb); |
595 | err = PTR_ERR(algt); | ||
596 | if (IS_ERR(algt)) | 595 | if (IS_ERR(algt)) |
597 | return ERR_PTR(err); | 596 | return ERR_CAST(algt); |
598 | 597 | ||
599 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 598 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
600 | return ERR_PTR(-EINVAL); | 599 | return ERR_PTR(-EINVAL); |
diff --git a/crypto/authencesn.c b/crypto/authencesn.c index 136b68b9d8d4..ab53762fc309 100644 --- a/crypto/authencesn.c +++ b/crypto/authencesn.c | |||
@@ -715,9 +715,8 @@ static struct crypto_instance *crypto_authenc_esn_alloc(struct rtattr **tb) | |||
715 | int err; | 715 | int err; |
716 | 716 | ||
717 | algt = crypto_get_attr_type(tb); | 717 | algt = crypto_get_attr_type(tb); |
718 | err = PTR_ERR(algt); | ||
719 | if (IS_ERR(algt)) | 718 | if (IS_ERR(algt)) |
720 | return ERR_PTR(err); | 719 | return ERR_CAST(algt); |
721 | 720 | ||
722 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 721 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
723 | return ERR_PTR(-EINVAL); | 722 | return ERR_PTR(-EINVAL); |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index a8d85a1d670e..e9e7244d5ef5 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -588,18 +588,16 @@ struct crypto_instance *skcipher_geniv_alloc(struct crypto_template *tmpl, | |||
588 | int err; | 588 | int err; |
589 | 589 | ||
590 | algt = crypto_get_attr_type(tb); | 590 | algt = crypto_get_attr_type(tb); |
591 | err = PTR_ERR(algt); | ||
592 | if (IS_ERR(algt)) | 591 | if (IS_ERR(algt)) |
593 | return ERR_PTR(err); | 592 | return ERR_CAST(algt); |
594 | 593 | ||
595 | if ((algt->type ^ (CRYPTO_ALG_TYPE_GIVCIPHER | CRYPTO_ALG_GENIV)) & | 594 | if ((algt->type ^ (CRYPTO_ALG_TYPE_GIVCIPHER | CRYPTO_ALG_GENIV)) & |
596 | algt->mask) | 595 | algt->mask) |
597 | return ERR_PTR(-EINVAL); | 596 | return ERR_PTR(-EINVAL); |
598 | 597 | ||
599 | name = crypto_attr_alg_name(tb[1]); | 598 | name = crypto_attr_alg_name(tb[1]); |
600 | err = PTR_ERR(name); | ||
601 | if (IS_ERR(name)) | 599 | if (IS_ERR(name)) |
602 | return ERR_PTR(err); | 600 | return ERR_CAST(name); |
603 | 601 | ||
604 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); | 602 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); |
605 | if (!inst) | 603 | if (!inst) |
diff --git a/crypto/ccm.c b/crypto/ccm.c index 32fe1bb5decb..499c91717d93 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c | |||
@@ -484,18 +484,16 @@ static struct crypto_instance *crypto_ccm_alloc_common(struct rtattr **tb, | |||
484 | int err; | 484 | int err; |
485 | 485 | ||
486 | algt = crypto_get_attr_type(tb); | 486 | algt = crypto_get_attr_type(tb); |
487 | err = PTR_ERR(algt); | ||
488 | if (IS_ERR(algt)) | 487 | if (IS_ERR(algt)) |
489 | return ERR_PTR(err); | 488 | return ERR_CAST(algt); |
490 | 489 | ||
491 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 490 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
492 | return ERR_PTR(-EINVAL); | 491 | return ERR_PTR(-EINVAL); |
493 | 492 | ||
494 | cipher = crypto_alg_mod_lookup(cipher_name, CRYPTO_ALG_TYPE_CIPHER, | 493 | cipher = crypto_alg_mod_lookup(cipher_name, CRYPTO_ALG_TYPE_CIPHER, |
495 | CRYPTO_ALG_TYPE_MASK); | 494 | CRYPTO_ALG_TYPE_MASK); |
496 | err = PTR_ERR(cipher); | ||
497 | if (IS_ERR(cipher)) | 495 | if (IS_ERR(cipher)) |
498 | return ERR_PTR(err); | 496 | return ERR_CAST(cipher); |
499 | 497 | ||
500 | err = -EINVAL; | 498 | err = -EINVAL; |
501 | if (cipher->cra_blocksize != 16) | 499 | if (cipher->cra_blocksize != 16) |
@@ -573,15 +571,13 @@ out_put_cipher: | |||
573 | 571 | ||
574 | static struct crypto_instance *crypto_ccm_alloc(struct rtattr **tb) | 572 | static struct crypto_instance *crypto_ccm_alloc(struct rtattr **tb) |
575 | { | 573 | { |
576 | int err; | ||
577 | const char *cipher_name; | 574 | const char *cipher_name; |
578 | char ctr_name[CRYPTO_MAX_ALG_NAME]; | 575 | char ctr_name[CRYPTO_MAX_ALG_NAME]; |
579 | char full_name[CRYPTO_MAX_ALG_NAME]; | 576 | char full_name[CRYPTO_MAX_ALG_NAME]; |
580 | 577 | ||
581 | cipher_name = crypto_attr_alg_name(tb[1]); | 578 | cipher_name = crypto_attr_alg_name(tb[1]); |
582 | err = PTR_ERR(cipher_name); | ||
583 | if (IS_ERR(cipher_name)) | 579 | if (IS_ERR(cipher_name)) |
584 | return ERR_PTR(err); | 580 | return ERR_CAST(cipher_name); |
585 | 581 | ||
586 | if (snprintf(ctr_name, CRYPTO_MAX_ALG_NAME, "ctr(%s)", | 582 | if (snprintf(ctr_name, CRYPTO_MAX_ALG_NAME, "ctr(%s)", |
587 | cipher_name) >= CRYPTO_MAX_ALG_NAME) | 583 | cipher_name) >= CRYPTO_MAX_ALG_NAME) |
@@ -612,20 +608,17 @@ static struct crypto_template crypto_ccm_tmpl = { | |||
612 | 608 | ||
613 | static struct crypto_instance *crypto_ccm_base_alloc(struct rtattr **tb) | 609 | static struct crypto_instance *crypto_ccm_base_alloc(struct rtattr **tb) |
614 | { | 610 | { |
615 | int err; | ||
616 | const char *ctr_name; | 611 | const char *ctr_name; |
617 | const char *cipher_name; | 612 | const char *cipher_name; |
618 | char full_name[CRYPTO_MAX_ALG_NAME]; | 613 | char full_name[CRYPTO_MAX_ALG_NAME]; |
619 | 614 | ||
620 | ctr_name = crypto_attr_alg_name(tb[1]); | 615 | ctr_name = crypto_attr_alg_name(tb[1]); |
621 | err = PTR_ERR(ctr_name); | ||
622 | if (IS_ERR(ctr_name)) | 616 | if (IS_ERR(ctr_name)) |
623 | return ERR_PTR(err); | 617 | return ERR_CAST(ctr_name); |
624 | 618 | ||
625 | cipher_name = crypto_attr_alg_name(tb[2]); | 619 | cipher_name = crypto_attr_alg_name(tb[2]); |
626 | err = PTR_ERR(cipher_name); | ||
627 | if (IS_ERR(cipher_name)) | 620 | if (IS_ERR(cipher_name)) |
628 | return ERR_PTR(err); | 621 | return ERR_CAST(cipher_name); |
629 | 622 | ||
630 | if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "ccm_base(%s,%s)", | 623 | if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "ccm_base(%s,%s)", |
631 | ctr_name, cipher_name) >= CRYPTO_MAX_ALG_NAME) | 624 | ctr_name, cipher_name) >= CRYPTO_MAX_ALG_NAME) |
@@ -760,17 +753,15 @@ static struct crypto_instance *crypto_rfc4309_alloc(struct rtattr **tb) | |||
760 | int err; | 753 | int err; |
761 | 754 | ||
762 | algt = crypto_get_attr_type(tb); | 755 | algt = crypto_get_attr_type(tb); |
763 | err = PTR_ERR(algt); | ||
764 | if (IS_ERR(algt)) | 756 | if (IS_ERR(algt)) |
765 | return ERR_PTR(err); | 757 | return ERR_CAST(algt); |
766 | 758 | ||
767 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 759 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
768 | return ERR_PTR(-EINVAL); | 760 | return ERR_PTR(-EINVAL); |
769 | 761 | ||
770 | ccm_name = crypto_attr_alg_name(tb[1]); | 762 | ccm_name = crypto_attr_alg_name(tb[1]); |
771 | err = PTR_ERR(ccm_name); | ||
772 | if (IS_ERR(ccm_name)) | 763 | if (IS_ERR(ccm_name)) |
773 | return ERR_PTR(err); | 764 | return ERR_CAST(ccm_name); |
774 | 765 | ||
775 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); | 766 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); |
776 | if (!inst) | 767 | if (!inst) |
diff --git a/crypto/chainiv.c b/crypto/chainiv.c index ba200b07449d..834d8dd3d4fc 100644 --- a/crypto/chainiv.c +++ b/crypto/chainiv.c | |||
@@ -291,9 +291,8 @@ static struct crypto_instance *chainiv_alloc(struct rtattr **tb) | |||
291 | int err; | 291 | int err; |
292 | 292 | ||
293 | algt = crypto_get_attr_type(tb); | 293 | algt = crypto_get_attr_type(tb); |
294 | err = PTR_ERR(algt); | ||
295 | if (IS_ERR(algt)) | 294 | if (IS_ERR(algt)) |
296 | return ERR_PTR(err); | 295 | return ERR_CAST(algt); |
297 | 296 | ||
298 | err = crypto_get_default_rng(); | 297 | err = crypto_get_default_rng(); |
299 | if (err) | 298 | if (err) |
diff --git a/crypto/ctr.c b/crypto/ctr.c index 4ca7222cfeb6..095dcb66d72d 100644 --- a/crypto/ctr.c +++ b/crypto/ctr.c | |||
@@ -334,9 +334,8 @@ static struct crypto_instance *crypto_rfc3686_alloc(struct rtattr **tb) | |||
334 | 334 | ||
335 | alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_BLKCIPHER, | 335 | alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_BLKCIPHER, |
336 | CRYPTO_ALG_TYPE_MASK); | 336 | CRYPTO_ALG_TYPE_MASK); |
337 | err = PTR_ERR(alg); | ||
338 | if (IS_ERR(alg)) | 337 | if (IS_ERR(alg)) |
339 | return ERR_PTR(err); | 338 | return ERR_CAST(alg); |
340 | 339 | ||
341 | /* We only support 16-byte blocks. */ | 340 | /* We only support 16-byte blocks. */ |
342 | err = -EINVAL; | 341 | err = -EINVAL; |
diff --git a/crypto/cts.c b/crypto/cts.c index ccf9c5de3958..042223f8e733 100644 --- a/crypto/cts.c +++ b/crypto/cts.c | |||
@@ -282,9 +282,8 @@ static struct crypto_instance *crypto_cts_alloc(struct rtattr **tb) | |||
282 | 282 | ||
283 | alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_BLKCIPHER, | 283 | alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_BLKCIPHER, |
284 | CRYPTO_ALG_TYPE_MASK); | 284 | CRYPTO_ALG_TYPE_MASK); |
285 | err = PTR_ERR(alg); | ||
286 | if (IS_ERR(alg)) | 285 | if (IS_ERR(alg)) |
287 | return ERR_PTR(err); | 286 | return ERR_CAST(alg); |
288 | 287 | ||
289 | inst = ERR_PTR(-EINVAL); | 288 | inst = ERR_PTR(-EINVAL); |
290 | if (!is_power_of_2(alg->cra_blocksize)) | 289 | if (!is_power_of_2(alg->cra_blocksize)) |
diff --git a/crypto/gcm.c b/crypto/gcm.c index 1a252639ef91..137ad1ec5438 100644 --- a/crypto/gcm.c +++ b/crypto/gcm.c | |||
@@ -701,9 +701,8 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb, | |||
701 | int err; | 701 | int err; |
702 | 702 | ||
703 | algt = crypto_get_attr_type(tb); | 703 | algt = crypto_get_attr_type(tb); |
704 | err = PTR_ERR(algt); | ||
705 | if (IS_ERR(algt)) | 704 | if (IS_ERR(algt)) |
706 | return ERR_PTR(err); | 705 | return ERR_CAST(algt); |
707 | 706 | ||
708 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 707 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
709 | return ERR_PTR(-EINVAL); | 708 | return ERR_PTR(-EINVAL); |
@@ -711,9 +710,8 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb, | |||
711 | ghash_alg = crypto_find_alg(ghash_name, &crypto_ahash_type, | 710 | ghash_alg = crypto_find_alg(ghash_name, &crypto_ahash_type, |
712 | CRYPTO_ALG_TYPE_HASH, | 711 | CRYPTO_ALG_TYPE_HASH, |
713 | CRYPTO_ALG_TYPE_AHASH_MASK); | 712 | CRYPTO_ALG_TYPE_AHASH_MASK); |
714 | err = PTR_ERR(ghash_alg); | ||
715 | if (IS_ERR(ghash_alg)) | 713 | if (IS_ERR(ghash_alg)) |
716 | return ERR_PTR(err); | 714 | return ERR_CAST(ghash_alg); |
717 | 715 | ||
718 | err = -ENOMEM; | 716 | err = -ENOMEM; |
719 | inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); | 717 | inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); |
@@ -787,15 +785,13 @@ out_put_ghash: | |||
787 | 785 | ||
788 | static struct crypto_instance *crypto_gcm_alloc(struct rtattr **tb) | 786 | static struct crypto_instance *crypto_gcm_alloc(struct rtattr **tb) |
789 | { | 787 | { |
790 | int err; | ||
791 | const char *cipher_name; | 788 | const char *cipher_name; |
792 | char ctr_name[CRYPTO_MAX_ALG_NAME]; | 789 | char ctr_name[CRYPTO_MAX_ALG_NAME]; |
793 | char full_name[CRYPTO_MAX_ALG_NAME]; | 790 | char full_name[CRYPTO_MAX_ALG_NAME]; |
794 | 791 | ||
795 | cipher_name = crypto_attr_alg_name(tb[1]); | 792 | cipher_name = crypto_attr_alg_name(tb[1]); |
796 | err = PTR_ERR(cipher_name); | ||
797 | if (IS_ERR(cipher_name)) | 793 | if (IS_ERR(cipher_name)) |
798 | return ERR_PTR(err); | 794 | return ERR_CAST(cipher_name); |
799 | 795 | ||
800 | if (snprintf(ctr_name, CRYPTO_MAX_ALG_NAME, "ctr(%s)", cipher_name) >= | 796 | if (snprintf(ctr_name, CRYPTO_MAX_ALG_NAME, "ctr(%s)", cipher_name) >= |
801 | CRYPTO_MAX_ALG_NAME) | 797 | CRYPTO_MAX_ALG_NAME) |
@@ -826,20 +822,17 @@ static struct crypto_template crypto_gcm_tmpl = { | |||
826 | 822 | ||
827 | static struct crypto_instance *crypto_gcm_base_alloc(struct rtattr **tb) | 823 | static struct crypto_instance *crypto_gcm_base_alloc(struct rtattr **tb) |
828 | { | 824 | { |
829 | int err; | ||
830 | const char *ctr_name; | 825 | const char *ctr_name; |
831 | const char *ghash_name; | 826 | const char *ghash_name; |
832 | char full_name[CRYPTO_MAX_ALG_NAME]; | 827 | char full_name[CRYPTO_MAX_ALG_NAME]; |
833 | 828 | ||
834 | ctr_name = crypto_attr_alg_name(tb[1]); | 829 | ctr_name = crypto_attr_alg_name(tb[1]); |
835 | err = PTR_ERR(ctr_name); | ||
836 | if (IS_ERR(ctr_name)) | 830 | if (IS_ERR(ctr_name)) |
837 | return ERR_PTR(err); | 831 | return ERR_CAST(ctr_name); |
838 | 832 | ||
839 | ghash_name = crypto_attr_alg_name(tb[2]); | 833 | ghash_name = crypto_attr_alg_name(tb[2]); |
840 | err = PTR_ERR(ghash_name); | ||
841 | if (IS_ERR(ghash_name)) | 834 | if (IS_ERR(ghash_name)) |
842 | return ERR_PTR(err); | 835 | return ERR_CAST(ghash_name); |
843 | 836 | ||
844 | if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "gcm_base(%s,%s)", | 837 | if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "gcm_base(%s,%s)", |
845 | ctr_name, ghash_name) >= CRYPTO_MAX_ALG_NAME) | 838 | ctr_name, ghash_name) >= CRYPTO_MAX_ALG_NAME) |
@@ -971,17 +964,15 @@ static struct crypto_instance *crypto_rfc4106_alloc(struct rtattr **tb) | |||
971 | int err; | 964 | int err; |
972 | 965 | ||
973 | algt = crypto_get_attr_type(tb); | 966 | algt = crypto_get_attr_type(tb); |
974 | err = PTR_ERR(algt); | ||
975 | if (IS_ERR(algt)) | 967 | if (IS_ERR(algt)) |
976 | return ERR_PTR(err); | 968 | return ERR_CAST(algt); |
977 | 969 | ||
978 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 970 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
979 | return ERR_PTR(-EINVAL); | 971 | return ERR_PTR(-EINVAL); |
980 | 972 | ||
981 | ccm_name = crypto_attr_alg_name(tb[1]); | 973 | ccm_name = crypto_attr_alg_name(tb[1]); |
982 | err = PTR_ERR(ccm_name); | ||
983 | if (IS_ERR(ccm_name)) | 974 | if (IS_ERR(ccm_name)) |
984 | return ERR_PTR(err); | 975 | return ERR_CAST(ccm_name); |
985 | 976 | ||
986 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); | 977 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); |
987 | if (!inst) | 978 | if (!inst) |
@@ -1222,17 +1213,15 @@ static struct crypto_instance *crypto_rfc4543_alloc(struct rtattr **tb) | |||
1222 | int err; | 1213 | int err; |
1223 | 1214 | ||
1224 | algt = crypto_get_attr_type(tb); | 1215 | algt = crypto_get_attr_type(tb); |
1225 | err = PTR_ERR(algt); | ||
1226 | if (IS_ERR(algt)) | 1216 | if (IS_ERR(algt)) |
1227 | return ERR_PTR(err); | 1217 | return ERR_CAST(algt); |
1228 | 1218 | ||
1229 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 1219 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
1230 | return ERR_PTR(-EINVAL); | 1220 | return ERR_PTR(-EINVAL); |
1231 | 1221 | ||
1232 | ccm_name = crypto_attr_alg_name(tb[1]); | 1222 | ccm_name = crypto_attr_alg_name(tb[1]); |
1233 | err = PTR_ERR(ccm_name); | ||
1234 | if (IS_ERR(ccm_name)) | 1223 | if (IS_ERR(ccm_name)) |
1235 | return ERR_PTR(err); | 1224 | return ERR_CAST(ccm_name); |
1236 | 1225 | ||
1237 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); | 1226 | inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); |
1238 | if (!inst) | 1227 | if (!inst) |
diff --git a/crypto/seqiv.c b/crypto/seqiv.c index 4c4491229417..f2cba4ed6f25 100644 --- a/crypto/seqiv.c +++ b/crypto/seqiv.c | |||
@@ -305,9 +305,8 @@ static struct crypto_instance *seqiv_alloc(struct rtattr **tb) | |||
305 | int err; | 305 | int err; |
306 | 306 | ||
307 | algt = crypto_get_attr_type(tb); | 307 | algt = crypto_get_attr_type(tb); |
308 | err = PTR_ERR(algt); | ||
309 | if (IS_ERR(algt)) | 308 | if (IS_ERR(algt)) |
310 | return ERR_PTR(err); | 309 | return ERR_CAST(algt); |
311 | 310 | ||
312 | err = crypto_get_default_rng(); | 311 | err = crypto_get_default_rng(); |
313 | if (err) | 312 | if (err) |