* [PATCH] bpftool: Fix the wrong format specifier
@ 2024-11-21 8:55 liujing
2024-11-21 11:46 ` Quentin Monnet
0 siblings, 1 reply; 6+ messages in thread
From: liujing @ 2024-11-21 8:55 UTC (permalink / raw)
To: qmo
Cc: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel,
liujing
The type of lines is unsigned int, so the correct format specifier should be
%u instead of %d.
Signed-off-by: liujing <liujing@cmss.chinamobile.com>
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 08d0ac543c67..030556ce4d61 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -423,7 +423,7 @@ static int do_batch(int argc, char **argv)
err = -1;
} else {
if (!json_output)
- printf("processed %d commands\n", lines);
+ printf("processed %u commands\n", lines);
}
err_close:
if (fp != stdin)
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] bpftool: Fix the wrong format specifier
2024-11-21 8:55 [PATCH] bpftool: Fix the wrong format specifier liujing
@ 2024-11-21 11:46 ` Quentin Monnet
0 siblings, 0 replies; 6+ messages in thread
From: Quentin Monnet @ 2024-11-21 11:46 UTC (permalink / raw)
To: liujing
Cc: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel
2024-11-21 16:55 UTC+0800 ~ liujing <liujing@cmss.chinamobile.com>
> The type of lines is unsigned int, so the correct format specifier should be
> %u instead of %d.
>
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
>
> diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
> index 08d0ac543c67..030556ce4d61 100644
> --- a/tools/bpf/bpftool/main.c
> +++ b/tools/bpf/bpftool/main.c
> @@ -423,7 +423,7 @@ static int do_batch(int argc, char **argv)
> err = -1;
> } else {
> if (!json_output)
> - printf("processed %d commands\n", lines);
> + printf("processed %u commands\n", lines);
> }
> err_close:
> if (fp != stdin)
Thank you for the fix. While at it can you also fix the format specifier
for the other two prints of "lines" in the function (via "p_err()"),
please? I guess they're not raised by your static checker, but they
should be addressed just the same.
Quentin
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] bpftool: Fix the wrong format specifier
@ 2024-11-21 12:17 liujing
2024-11-21 12:43 ` Alexis Lothoré
2024-11-25 22:32 ` Alexei Starovoitov
0 siblings, 2 replies; 6+ messages in thread
From: liujing @ 2024-11-21 12:17 UTC (permalink / raw)
To: qmo, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa
Cc: bpf, linux-kernel, liujing
The type of lines is unsigned int, so the correct format specifier should be
%u instead of %d.
Signed-off-by: liujing <liujing@cmss.chinamobile.com>
V1 -> V2: Fixed two other wrong type outputs about lines
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 08d0ac543c67..84f723b275e3 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -370,7 +370,7 @@ static int do_batch(int argc, char **argv)
while ((cp = strstr(buf, "\\\n")) != NULL) {
if (!fgets(contline, sizeof(contline), fp) ||
strlen(contline) == 0) {
- p_err("missing continuation line on command %d",
+ p_err("missing continuation line on command %u",
lines);
err = -1;
goto err_close;
@@ -381,7 +381,7 @@ static int do_batch(int argc, char **argv)
*cp = '\0';
if (strlen(buf) + strlen(contline) + 1 > sizeof(buf)) {
- p_err("command %d is too long", lines);
+ p_err("command %u is too long", lines);
err = -1;
goto err_close;
}
@@ -423,7 +423,7 @@ static int do_batch(int argc, char **argv)
err = -1;
} else {
if (!json_output)
- printf("processed %d commands\n", lines);
+ printf("processed %u commands\n", lines);
}
err_close:
if (fp != stdin)
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] bpftool: Fix the wrong format specifier
2024-11-21 12:17 liujing
@ 2024-11-21 12:43 ` Alexis Lothoré
2024-11-21 15:35 ` Quentin Monnet
2024-11-25 22:32 ` Alexei Starovoitov
1 sibling, 1 reply; 6+ messages in thread
From: Alexis Lothoré @ 2024-11-21 12:43 UTC (permalink / raw)
To: liujing, qmo, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa
Cc: bpf, linux-kernel
Hi Liujing,
On 11/21/24 13:17, liujing wrote:
> The type of lines is unsigned int, so the correct format specifier should be
> %u instead of %d.
>
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
>
> V1 -> V2: Fixed two other wrong type outputs about lines
This commit changelog line should not appear in the commit message. This is
still useful for review though, so you can keep it in the commit by using a ---
separator (see other patches on the ML), which will make it automatically
trimmed when the maintainers will apply the patch.
Thanks
Alexis
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpftool: Fix the wrong format specifier
2024-11-21 12:43 ` Alexis Lothoré
@ 2024-11-21 15:35 ` Quentin Monnet
0 siblings, 0 replies; 6+ messages in thread
From: Quentin Monnet @ 2024-11-21 15:35 UTC (permalink / raw)
To: Alexis Lothoré, liujing, daniel, andrii, martin.lau, eddyz87,
song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa
Cc: bpf, linux-kernel
2024-11-21 13:43 UTC+0100 ~ Alexis Lothoré <alexis.lothore@bootlin.com>
> Hi Liujing,
>
> On 11/21/24 13:17, liujing wrote:
>> The type of lines is unsigned int, so the correct format specifier should be
>> %u instead of %d.
>>
>> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
>>
>> V1 -> V2: Fixed two other wrong type outputs about lines
>
> This commit changelog line should not appear in the commit message. This is
> still useful for review though, so you can keep it in the commit by using a ---
> separator (see other patches on the ML), which will make it automatically
> trimmed when the maintainers will apply the patch.
Also next time please remember to tag your patch as "v2" in the email
subject.
Patch looks good, thank you!
Reviewed-by: Quentin Monnet <qmo@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bpftool: Fix the wrong format specifier
2024-11-21 12:17 liujing
2024-11-21 12:43 ` Alexis Lothoré
@ 2024-11-25 22:32 ` Alexei Starovoitov
1 sibling, 0 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2024-11-25 22:32 UTC (permalink / raw)
To: liujing
Cc: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eddy Z, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf, LKML
On Thu, Nov 21, 2024 at 4:17 AM liujing <liujing@cmss.chinamobile.com> wrote:
>
> The type of lines is unsigned int, so the correct format specifier should be
> %u instead of %d.
>
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
Please use your full name.
Same issue with another patch.
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-25 22:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 8:55 [PATCH] bpftool: Fix the wrong format specifier liujing
2024-11-21 11:46 ` Quentin Monnet
-- strict thread matches above, loose matches on Subject: below --
2024-11-21 12:17 liujing
2024-11-21 12:43 ` Alexis Lothoré
2024-11-21 15:35 ` Quentin Monnet
2024-11-25 22:32 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox