BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] bpf: Use isdigit() in bpf_bprintf_prepare()
@ 2026-12-04 21:30 Thorsten Blum
  2026-12-05  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-12-04 21:30 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai
  Cc: Thorsten Blum, bpf

Use isdigit() to skip the width digits and drop the extra if check since
the preceding loop already skips leading zeroes.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
Changes in v2:
- Drop the redundant if check (Alexei)
- v1: https://lore.kernel.org/r/20261121005306.942603-2-blum@kernel.org/

 kernel/bpf/helpers.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index cebf9d8dfe36..a7a507482e6f 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -926,11 +926,8 @@ int bpf_bprintf_prepare(const char *fmt, u32 fmt_size, const u64 *raw_args,
 		while (fmt[i] == '0' || fmt[i] == '+'  || fmt[i] == '-' ||
 		       fmt[i] == ' ')
 			i++;
-		if (fmt[i] >= '1' && fmt[i] <= '9') {
+		while (isdigit(fmt[i]))
 			i++;
-			while (fmt[i] >= '0' && fmt[i] <= '9')
-				i++;
-		}
 
 		if (fmt[i] == 'p') {
 			sizeof_cur_arg = sizeof(long);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next v2] bpf: Use isdigit() in bpf_bprintf_prepare()
  2026-12-04 21:30 [PATCH bpf-next v2] bpf: Use isdigit() in bpf_bprintf_prepare() Thorsten Blum
@ 2026-12-05  1:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-05  1:50 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
	yonghong.song, jolsa, emil, ihor.solodrai, bpf

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Fri,  4 Dec 2026 22:30:08 +0100 you wrote:
> Use isdigit() to skip the width digits and drop the extra if check since
> the preceding loop already skips leading zeroes.
> 
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
> Changes in v2:
> - Drop the redundant if check (Alexei)
> - v1: https://lore.kernel.org/r/20261121005306.942603-2-blum@kernel.org/
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2] bpf: Use isdigit() in bpf_bprintf_prepare()
    https://git.kernel.org/bpf/bpf-next/c/ddc8b115d299

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] 2+ messages in thread

end of thread, other threads:[~2026-12-05  1:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 21:30 [PATCH bpf-next v2] bpf: Use isdigit() in bpf_bprintf_prepare() Thorsten Blum
2026-12-05  1:50 ` 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