From: Quentin Monnet <qmo@kernel.org>
To: Zhu Jun <zhujun2@cmss.chinamobile.com>
Cc: ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] tools/bpf:Fix the wrong format specifier
Date: Wed, 24 Jul 2024 11:13:07 +0100 [thread overview]
Message-ID: <2d6875dd-6050-4f57-9a6d-9168634aa6c4@kernel.org> (raw)
In-Reply-To: <20240724100022.10850-1-zhujun2@cmss.chinamobile.com>
2024-07-24 03:00 UTC-0700 ~ Zhu Jun <zhujun2@cmss.chinamobile.com>
> The format specifier of "unsigned int" in printf() should be "%u", not
> "%d".
>
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
> Changes:
> v2:modify commit info
> v3:fix compile warninf
>
> tools/bpf/bpftool/xlated_dumper.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c
> index 567f56dfd9f1..d9c198e0a875 100644
> --- a/tools/bpf/bpftool/xlated_dumper.c
> +++ b/tools/bpf/bpftool/xlated_dumper.c
> @@ -316,7 +316,7 @@ void dump_xlated_plain(struct dump_data *dd, void *buf, unsigned int len,
> unsigned int nr_skip = 0;
> bool double_insn = false;
> char func_sig[1024];
> - unsigned int i;
> + int i;
Thanks! But unsigned seems relevant here, and it doesn't make much sense
to change the type of the int just because we don't have the right
specifier in the printf(), does it? Sorry, I should have been more
explicit: the warning on v1 and v2 can be addressed by simply removing
the "space flag" from the format string, in other words:
printf("%4u: ", i);
Instead of what you had:
printf("% 4u: ", i);
Quentin
next prev parent reply other threads:[~2024-07-24 10:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 10:00 [PATCH v3] tools/bpf:Fix the wrong format specifier Zhu Jun
2024-07-24 10:13 ` Quentin Monnet [this message]
2024-07-24 14:38 ` [PATCH v3] tools/bpf: Fix " Markus Elfring
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=2d6875dd-6050-4f57-9a6d-9168634aa6c4@kernel.org \
--to=qmo@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
--cc=zhujun2@cmss.chinamobile.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox