* [PATCH] samples/bpf: use %lu format specifier for unsigned long values
@ 2023-12-19 15:23 Colin Ian King
2023-12-19 22:02 ` Randy Dunlap
2023-12-20 15:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2023-12-19 15:23 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf
Cc: kernel-janitors, linux-kernel
Currently %ld format specifiers are being used for unsigned long
values. Fix this by using %lu instead. Cleans up cppcheck warnings:
warning: %ld in format string (no. 1) requires 'long' but the argument
type is 'unsigned long'. [invalidPrintfArgType_sint]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
samples/bpf/cpustat_user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/samples/bpf/cpustat_user.c b/samples/bpf/cpustat_user.c
index ab90bb08a2b4..356f756cba0d 100644
--- a/samples/bpf/cpustat_user.c
+++ b/samples/bpf/cpustat_user.c
@@ -66,10 +66,10 @@ static void cpu_stat_print(void)
printf("CPU-%-6d ", j);
for (i = 0; i < MAX_CSTATE_ENTRIES; i++)
- printf("%-11ld ", data->cstate[i] / 1000000);
+ printf("%-11lu ", data->cstate[i] / 1000000);
for (i = 0; i < MAX_PSTATE_ENTRIES; i++)
- printf("%-11ld ", data->pstate[i] / 1000000);
+ printf("%-11lu ", data->pstate[i] / 1000000);
printf("\n");
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] samples/bpf: use %lu format specifier for unsigned long values
2023-12-19 15:23 [PATCH] samples/bpf: use %lu format specifier for unsigned long values Colin Ian King
@ 2023-12-19 22:02 ` Randy Dunlap
2023-12-20 15:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2023-12-19 22:02 UTC (permalink / raw)
To: Colin Ian King, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
bpf
Cc: kernel-janitors, linux-kernel
On 12/19/23 07:23, Colin Ian King wrote:
> Currently %ld format specifiers are being used for unsigned long
> values. Fix this by using %lu instead. Cleans up cppcheck warnings:
>
> warning: %ld in format string (no. 1) requires 'long' but the argument
> type is 'unsigned long'. [invalidPrintfArgType_sint]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> samples/bpf/cpustat_user.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/samples/bpf/cpustat_user.c b/samples/bpf/cpustat_user.c
> index ab90bb08a2b4..356f756cba0d 100644
> --- a/samples/bpf/cpustat_user.c
> +++ b/samples/bpf/cpustat_user.c
> @@ -66,10 +66,10 @@ static void cpu_stat_print(void)
>
> printf("CPU-%-6d ", j);
> for (i = 0; i < MAX_CSTATE_ENTRIES; i++)
> - printf("%-11ld ", data->cstate[i] / 1000000);
> + printf("%-11lu ", data->cstate[i] / 1000000);
>
> for (i = 0; i < MAX_PSTATE_ENTRIES; i++)
> - printf("%-11ld ", data->pstate[i] / 1000000);
> + printf("%-11lu ", data->pstate[i] / 1000000);
>
> printf("\n");
> }
--
#Randy
https://people.kernel.org/tglx/notes-about-netiquette
https://subspace.kernel.org/etiquette.html
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] samples/bpf: use %lu format specifier for unsigned long values
2023-12-19 15:23 [PATCH] samples/bpf: use %lu format specifier for unsigned long values Colin Ian King
2023-12-19 22:02 ` Randy Dunlap
@ 2023-12-20 15:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-20 15:10 UTC (permalink / raw)
To: Colin Ian King
Cc: ast, daniel, andrii, martin.lau, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, bpf, kernel-janitors,
linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Tue, 19 Dec 2023 15:23:07 +0000 you wrote:
> Currently %ld format specifiers are being used for unsigned long
> values. Fix this by using %lu instead. Cleans up cppcheck warnings:
>
> warning: %ld in format string (no. 1) requires 'long' but the argument
> type is 'unsigned long'. [invalidPrintfArgType_sint]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>
> [...]
Here is the summary with links:
- samples/bpf: use %lu format specifier for unsigned long values
https://git.kernel.org/bpf/bpf-next/c/32f24938a1fc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-20 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 15:23 [PATCH] samples/bpf: use %lu format specifier for unsigned long values Colin Ian King
2023-12-19 22:02 ` Randy Dunlap
2023-12-20 15:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox