diff mbox series

[4/7] tpm: Correct warning on 32-bit build

Message ID 20210207212707.3958570-5-sjg@chromium.org
State Accepted
Commit e7c920a22800ade845a656f7925c1977e69e95b1
Delegated to: Tom Rini
Headers show
Series Fix compiler warnings for 32-bit ARM | expand

Commit Message

Simon Glass Feb. 7, 2021, 9:27 p.m. UTC
Fix the warning:

drivers/tpm/tpm2_tis_sandbox.c: In function ‘sandbox_tpm2_xfer’:
drivers/tpm/tpm2_tis_sandbox.c:288:48: warning: format ‘%ld’ expects
	argument of type ‘long int’, but argument 2 has type ‘size_t’
	{aka ‘unsigned int’} [-Wformat=]
   printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
                                              ~~^
                                              %d
          send_size, length);
          ~~~~~~~~~

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/tpm/tpm2_tis_sandbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt Feb. 7, 2021, 9:31 p.m. UTC | #1
On 2/7/21 10:27 PM, Simon Glass wrote:
> Fix the warning:
>
> drivers/tpm/tpm2_tis_sandbox.c: In function ‘sandbox_tpm2_xfer’:
> drivers/tpm/tpm2_tis_sandbox.c:288:48: warning: format ‘%ld’ expects
> 	argument of type ‘long int’, but argument 2 has type ‘size_t’
> 	{aka ‘unsigned int’} [-Wformat=]
>     printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
>                                                ~~^
>                                                %d
>            send_size, length);
>            ~~~~~~~~~
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   drivers/tpm/tpm2_tis_sandbox.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
> index c74bacfd719..24c804a5645 100644
> --- a/drivers/tpm/tpm2_tis_sandbox.c
> +++ b/drivers/tpm/tpm2_tis_sandbox.c
> @@ -285,7 +285,7 @@ static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
>   	length = get_unaligned_be32(sent);
>   	sent += sizeof(length);
>   	if (length != send_size) {
> -		printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
> +		printf("TPM2: Unmatching length, received: %zd, expected: %d\n",

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>   		       send_size, length);
>   		rc = TPM2_RC_SIZE;
>   		sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);
>
Tom Rini March 15, 2021, 3:52 p.m. UTC | #2
On Sun, Feb 07, 2021 at 02:27:04PM -0700, Simon Glass wrote:

> Fix the warning:
> 
> drivers/tpm/tpm2_tis_sandbox.c: In function ‘sandbox_tpm2_xfer’:
> drivers/tpm/tpm2_tis_sandbox.c:288:48: warning: format ‘%ld’ expects
> 	argument of type ‘long int’, but argument 2 has type ‘size_t’
> 	{aka ‘unsigned int’} [-Wformat=]
>    printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
>                                               ~~^
>                                               %d
>           send_size, length);
>           ~~~~~~~~~
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
index c74bacfd719..24c804a5645 100644
--- a/drivers/tpm/tpm2_tis_sandbox.c
+++ b/drivers/tpm/tpm2_tis_sandbox.c
@@ -285,7 +285,7 @@  static int sandbox_tpm2_xfer(struct udevice *dev, const u8 *sendbuf,
 	length = get_unaligned_be32(sent);
 	sent += sizeof(length);
 	if (length != send_size) {
-		printf("TPM2: Unmatching length, received: %ld, expected: %d\n",
+		printf("TPM2: Unmatching length, received: %zd, expected: %d\n",
 		       send_size, length);
 		rc = TPM2_RC_SIZE;
 		sandbox_tpm2_fill_buf(recv, recv_len, tag, rc);