diff mbox series

crypto: arm/sha256-neon - Fix clang function cast warnings

Message ID ZD+1BQd8Phqk3lzv@gondor.apana.org.au
State Accepted
Commit 547ea1b1ea488609b8c33b1bebaa0f03e1d28049
Headers show
Series crypto: arm/sha256-neon - Fix clang function cast warnings | expand

Commit Message

Herbert Xu April 19, 2023, 9:31 a.m. UTC
Instead of casting the function which upsets clang for some reason,
change the assembly function siganture instead.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304081828.zjGcFUyE-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Comments

Nick Desaulniers April 19, 2023, 9:53 p.m. UTC | #1
On Wed, Apr 19, 2023 at 2:32 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> Instead of casting the function which upsets clang for some reason,
> change the assembly function siganture instead.

Thanks for the patch, same comments as the sha1 patch:
https://lore.kernel.org/oe-kbuild-all/CAKwvOdm2VyCzfmG6707osmtyniV-oL-ism08kER49D7p_7x+Rg@mail.gmail.com/
though sha256_block_data_order_neon is defined in
arch/arm/crypto/sha256-armv4.pl and does not have any comments about
the function signature.
Also, I see a few more casts to sha256_block_fn:

arch/arm/crypto/sha256_glue.c
37:                             (sha256_block_fn *)sha256_block_data_order);
44:                             (sha256_block_fn *)sha256_block_data_order);
52:                           (sha256_block_fn *)sha256_block_data_order);

arch/arm/crypto/sha2-ce-glue.c
41:                           (sha256_block_fn *)sha2_ce_transform);
56:                                   (sha256_block_fn *)sha2_ce_transform);
57:     sha256_base_do_finalize(desc, (sha256_block_fn *)sha2_ce_transform);

Can those be cleaned up, too? (Either in this patch or a follow up?)

>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304081828.zjGcFUyE-lkp@intel.com/
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/arch/arm/crypto/sha256_neon_glue.c b/arch/arm/crypto/sha256_neon_glue.c
> index 701706262ef3..ccdcfff71910 100644
> --- a/arch/arm/crypto/sha256_neon_glue.c
> +++ b/arch/arm/crypto/sha256_neon_glue.c
> @@ -21,8 +21,8 @@
>
>  #include "sha256_glue.h"
>
> -asmlinkage void sha256_block_data_order_neon(u32 *digest, const void *data,
> -                                            unsigned int num_blks);
> +asmlinkage void sha256_block_data_order_neon(struct sha256_state *digest,
> +                                            const u8 *data, int num_blks);
>
>  static int crypto_sha256_neon_update(struct shash_desc *desc, const u8 *data,
>                                      unsigned int len)
> @@ -34,8 +34,7 @@ static int crypto_sha256_neon_update(struct shash_desc *desc, const u8 *data,
>                 return crypto_sha256_arm_update(desc, data, len);
>
>         kernel_neon_begin();
> -       sha256_base_do_update(desc, data, len,
> -                       (sha256_block_fn *)sha256_block_data_order_neon);
> +       sha256_base_do_update(desc, data, len, sha256_block_data_order_neon);
>         kernel_neon_end();
>
>         return 0;
> @@ -50,9 +49,8 @@ static int crypto_sha256_neon_finup(struct shash_desc *desc, const u8 *data,
>         kernel_neon_begin();
>         if (len)
>                 sha256_base_do_update(desc, data, len,
> -                       (sha256_block_fn *)sha256_block_data_order_neon);
> -       sha256_base_do_finalize(desc,
> -                       (sha256_block_fn *)sha256_block_data_order_neon);
> +                                     sha256_block_data_order_neon);
> +       sha256_base_do_finalize(desc, sha256_block_data_order_neon);
>         kernel_neon_end();
>
>         return sha256_base_finish(desc, out);
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
Nick Desaulniers April 19, 2023, 9:56 p.m. UTC | #2
On Wed, Apr 19, 2023 at 2:35 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> Instead of casting the function which upsets clang for some reason,
> change the assembly function siganture instead.

Same comments as sha1 and sha256.  Looks like more casts to remove:

arch/arm/crypto/sha512-glue.c
34:             (sha512_block_fn *)sha512_block_data_order);
40:             (sha512_block_fn *)sha512_block_data_order);
48:             (sha512_block_fn *)sha512_block_data_order);



>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304081828.zjGcFUyE-lkp@intel.com/
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/arch/arm/crypto/sha512-neon-glue.c b/arch/arm/crypto/sha512-neon-glue.c
> index c879ad32db51..c6e58fe475ac 100644
> --- a/arch/arm/crypto/sha512-neon-glue.c
> +++ b/arch/arm/crypto/sha512-neon-glue.c
> @@ -20,8 +20,8 @@
>  MODULE_ALIAS_CRYPTO("sha384-neon");
>  MODULE_ALIAS_CRYPTO("sha512-neon");
>
> -asmlinkage void sha512_block_data_order_neon(u64 *state, u8 const *src,
> -                                            int blocks);
> +asmlinkage void sha512_block_data_order_neon(struct sha512_state *state,
> +                                            const u8 *src, int blocks);
>
>  static int sha512_neon_update(struct shash_desc *desc, const u8 *data,
>                               unsigned int len)
> @@ -33,8 +33,7 @@ static int sha512_neon_update(struct shash_desc *desc, const u8 *data,
>                 return sha512_arm_update(desc, data, len);
>
>         kernel_neon_begin();
> -       sha512_base_do_update(desc, data, len,
> -               (sha512_block_fn *)sha512_block_data_order_neon);
> +       sha512_base_do_update(desc, data, len, sha512_block_data_order_neon);
>         kernel_neon_end();
>
>         return 0;
> @@ -49,9 +48,8 @@ static int sha512_neon_finup(struct shash_desc *desc, const u8 *data,
>         kernel_neon_begin();
>         if (len)
>                 sha512_base_do_update(desc, data, len,
> -                       (sha512_block_fn *)sha512_block_data_order_neon);
> -       sha512_base_do_finalize(desc,
> -               (sha512_block_fn *)sha512_block_data_order_neon);
> +                                     sha512_block_data_order_neon);
> +       sha512_base_do_finalize(desc, sha512_block_data_order_neon);
>         kernel_neon_end();
>
>         return sha512_base_finish(desc, out);
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
diff mbox series

Patch

diff --git a/arch/arm/crypto/sha256_neon_glue.c b/arch/arm/crypto/sha256_neon_glue.c
index 701706262ef3..ccdcfff71910 100644
--- a/arch/arm/crypto/sha256_neon_glue.c
+++ b/arch/arm/crypto/sha256_neon_glue.c
@@ -21,8 +21,8 @@ 
 
 #include "sha256_glue.h"
 
-asmlinkage void sha256_block_data_order_neon(u32 *digest, const void *data,
-					     unsigned int num_blks);
+asmlinkage void sha256_block_data_order_neon(struct sha256_state *digest,
+					     const u8 *data, int num_blks);
 
 static int crypto_sha256_neon_update(struct shash_desc *desc, const u8 *data,
 				     unsigned int len)
@@ -34,8 +34,7 @@  static int crypto_sha256_neon_update(struct shash_desc *desc, const u8 *data,
 		return crypto_sha256_arm_update(desc, data, len);
 
 	kernel_neon_begin();
-	sha256_base_do_update(desc, data, len,
-			(sha256_block_fn *)sha256_block_data_order_neon);
+	sha256_base_do_update(desc, data, len, sha256_block_data_order_neon);
 	kernel_neon_end();
 
 	return 0;
@@ -50,9 +49,8 @@  static int crypto_sha256_neon_finup(struct shash_desc *desc, const u8 *data,
 	kernel_neon_begin();
 	if (len)
 		sha256_base_do_update(desc, data, len,
-			(sha256_block_fn *)sha256_block_data_order_neon);
-	sha256_base_do_finalize(desc,
-			(sha256_block_fn *)sha256_block_data_order_neon);
+				      sha256_block_data_order_neon);
+	sha256_base_do_finalize(desc, sha256_block_data_order_neon);
 	kernel_neon_end();
 
 	return sha256_base_finish(desc, out);