All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ye Bin <yebin10@huawei.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	mcoquelin.stm32@gmail.com, alexandre.torgue@st.com,
	linux-crypto@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: testmgr - Fix format argument warning
Date: Sat, 10 Oct 2020 11:32:26 -0700	[thread overview]
Message-ID: <20201010183226.GA1808@sol.localdomain> (raw)
In-Reply-To: <20201010021637.112091-1-yebin10@huawei.com>

On Sat, Oct 10, 2020 at 10:16:37AM +0800, Ye Bin wrote:
> Fix follow warning:
> [crypto/testmgr.c:2317]: (warning) %d in format string (no. 5) requires
> 'int' but the argument type is 'unsigned int'.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  crypto/testmgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index a64a639eddfa..aefa4b6b8d78 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -2315,7 +2315,7 @@ static void generate_random_aead_testvec(struct aead_request *req,
>  	if (vec->setkey_error == 0 && vec->setauthsize_error == 0)
>  		generate_aead_message(req, suite, vec, prefer_inauthentic);
>  	snprintf(name, max_namelen,
> -		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%d\"",
> +		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%u\"",
>  		 vec->alen, vec->plen, authsize, vec->klen, vec->novrfy);

Actually vec->novrfy is 'unsigned char', not 'unsigned int'.  Both %u and %d
will work, but %d is technically correct because 'unsigned char' gets promoted
to 'int'.  What tool are you using that claims this is wrong?

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Ye Bin <yebin10@huawei.com>
Cc: alexandre.torgue@st.com, linux-kernel@vger.kernel.org,
	davem@davemloft.net, linux-crypto@vger.kernel.org,
	mcoquelin.stm32@gmail.com,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	herbert@gondor.apana.org.au
Subject: Re: [PATCH] crypto: testmgr - Fix format argument warning
Date: Sat, 10 Oct 2020 11:32:26 -0700	[thread overview]
Message-ID: <20201010183226.GA1808@sol.localdomain> (raw)
In-Reply-To: <20201010021637.112091-1-yebin10@huawei.com>

On Sat, Oct 10, 2020 at 10:16:37AM +0800, Ye Bin wrote:
> Fix follow warning:
> [crypto/testmgr.c:2317]: (warning) %d in format string (no. 5) requires
> 'int' but the argument type is 'unsigned int'.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  crypto/testmgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> index a64a639eddfa..aefa4b6b8d78 100644
> --- a/crypto/testmgr.c
> +++ b/crypto/testmgr.c
> @@ -2315,7 +2315,7 @@ static void generate_random_aead_testvec(struct aead_request *req,
>  	if (vec->setkey_error == 0 && vec->setauthsize_error == 0)
>  		generate_aead_message(req, suite, vec, prefer_inauthentic);
>  	snprintf(name, max_namelen,
> -		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%d\"",
> +		 "\"random: alen=%u plen=%u authsize=%u klen=%u novrfy=%u\"",
>  		 vec->alen, vec->plen, authsize, vec->klen, vec->novrfy);

Actually vec->novrfy is 'unsigned char', not 'unsigned int'.  Both %u and %d
will work, but %d is technically correct because 'unsigned char' gets promoted
to 'int'.  What tool are you using that claims this is wrong?

- Eric

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-10-10 22:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10  2:16 [PATCH] crypto: testmgr - Fix format argument warning Ye Bin
2020-10-10  2:16 ` Ye Bin
2020-10-10 18:32 ` Eric Biggers [this message]
2020-10-10 18:32   ` Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201010183226.GA1808@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=yebin10@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.