From: Stefan Berger <stefanb@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Liam Merwick" <liam.merwick@oracle.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] tpm_tis: fix format string specifier in tpm_tis_show_buffer()
Date: Mon, 11 Feb 2019 14:56:41 -0500 [thread overview]
Message-ID: <0251e2fc-3dbd-937a-0649-71fcd64e2d14@linux.ibm.com> (raw)
In-Reply-To: <13b4d86c-0af3-12b9-fce5-92f1eb0fe95d@redhat.com>
On 2/11/19 11:02 AM, Philippe Mathieu-Daudé wrote:
> Hi Liam,
>
> On 2/11/19 4:03 PM, Liam Merwick wrote:
>> cppcheck reports:
>>
>> [hw/tpm/tpm_tis.c:113]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'
>>
>> Fix this by using %u instead of %d
Liam, Neither gcc nor cppcheck 1.86 complains about this on my system.
What version of cppcheck are you using?
>>
>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>> ---
>> hw/tpm/tpm_tis.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>> index 860c2ace7d99..395500e8a61d 100644
>> --- a/hw/tpm/tpm_tis.c
>> +++ b/hw/tpm/tpm_tis.c
>> @@ -110,7 +110,7 @@ static void tpm_tis_show_buffer(const unsigned char *buffer,
>> uint32_t len, i;
> If you want to clean this, use a size_t here instead of u32.
>
>>
>> len = MIN(tpm_cmd_get_size(buffer), buffer_size);
>> - printf("tpm_tis: %s length = %d\n", string, len);
>> + printf("tpm_tis: %s length = %u\n", string, len);
> So here the format is '%zu'.
> However in code cleanup we try go get ride of printf() calls and replace
> them with trace points.
This code is only used for debugging if DEBUG_TIS has been #defined. No
need to add tracing here.
>
>> for (i = 0; i < len; i++) {
>> if (i && !(i % 16)) {
>> printf("\n");
>>
next prev parent reply other threads:[~2019-02-11 19:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 15:03 [Qemu-devel] [PATCH v2 1/3] tpm_tis: fix loop that cancels any seizure by a lower locality Liam Merwick
2019-02-11 15:03 ` [Qemu-devel] [PATCH v2 2/3] tpm_tis: assert valid addr passed to tpm_tis_locality_from_addr() Liam Merwick
2019-02-12 17:29 ` Stefan Berger
2019-02-11 15:03 ` [Qemu-devel] [PATCH v2 3/3] tpm_tis: fix format string specifier in tpm_tis_show_buffer() Liam Merwick
2019-02-11 16:02 ` Philippe Mathieu-Daudé
2019-02-11 19:56 ` Stefan Berger [this message]
2019-02-11 20:09 ` Liam Merwick
2019-02-11 21:13 ` Stefan Berger
2019-02-12 12:31 ` Philippe Mathieu-Daudé
2019-02-12 13:27 ` Stefan Berger
2019-02-12 13:43 ` Liam Merwick
2019-02-12 14:32 ` Philippe Mathieu-Daudé
2019-02-12 12:02 ` Stefan Berger
2019-02-11 20:53 ` [Qemu-devel] [PATCH v2 1/3] tpm_tis: fix loop that cancels any seizure by a lower locality Stefan Berger
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=0251e2fc-3dbd-937a-0649-71fcd64e2d14@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=liam.merwick@oracle.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).