2019-10-19 09:50:47

by tiantao (H)

[permalink] [raw]
Subject: [PATCH v2] crypto: fix comparison of unsigned expression warning

This patch fixes the following warnings:
drivers/crypto/ccree/cc_aead.c:630:5-12: WARNING: Unsigned expression
compared with zero: seq_len > 0

Signed-off-by: Tian Tao <[email protected]>

v2:
change hmac_setkey() return type to unsigned int to fix the warning.
---
drivers/crypto/ccree/cc_aead.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c
index d3e8faa..64d318d 100644
--- a/drivers/crypto/ccree/cc_aead.c
+++ b/drivers/crypto/ccree/cc_aead.c
@@ -293,7 +293,8 @@ static unsigned int xcbc_setkey(struct cc_hw_desc *desc,
return 4;
}

-static int hmac_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
+static unsigned int hmac_setkey(struct cc_hw_desc *desc,
+ struct cc_aead_ctx *ctx)
{
unsigned int hmac_pad_const[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST };
unsigned int digest_ofs = 0;
--
2.7.4


2019-10-25 11:55:52

by Gilad Ben-Yossef

[permalink] [raw]
Subject: Re: [PATCH v2] crypto: fix comparison of unsigned expression warning

On Sat, Oct 19, 2019 at 3:44 AM Tian Tao <[email protected]> wrote:
>
> This patch fixes the following warnings:
> drivers/crypto/ccree/cc_aead.c:630:5-12: WARNING: Unsigned expression
> compared with zero: seq_len > 0
>
> Signed-off-by: Tian Tao <[email protected]>


Acked-by: Gilad Ben-Yossef <[email protected]>

Thanks,
Gilad

>
> v2:
> change hmac_setkey() return type to unsigned int to fix the warning.
> ---
> drivers/crypto/ccree/cc_aead.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c
> index d3e8faa..64d318d 100644
> --- a/drivers/crypto/ccree/cc_aead.c
> +++ b/drivers/crypto/ccree/cc_aead.c
> @@ -293,7 +293,8 @@ static unsigned int xcbc_setkey(struct cc_hw_desc *desc,
> return 4;
> }
>
> -static int hmac_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
> +static unsigned int hmac_setkey(struct cc_hw_desc *desc,
> + struct cc_aead_ctx *ctx)
> {
> unsigned int hmac_pad_const[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST };
> unsigned int digest_ofs = 0;
> --
> 2.7.4
>


--
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

2019-10-25 20:42:03

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v2] crypto: fix comparison of unsigned expression warning

On Sat, Oct 19, 2019 at 08:41:37AM +0800, Tian Tao wrote:
> This patch fixes the following warnings:
> drivers/crypto/ccree/cc_aead.c:630:5-12: WARNING: Unsigned expression
> compared with zero: seq_len > 0
>
> Signed-off-by: Tian Tao <[email protected]>
>
> v2:
> change hmac_setkey() return type to unsigned int to fix the warning.
> ---
> drivers/crypto/ccree/cc_aead.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt