From: Thorsten Blum <blum@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>
Cc: Thorsten Blum <blum@kernel.org>, bpf@vger.kernel.org
Subject: [PATCH bpf-next v2] bpf: Use isdigit() in bpf_bprintf_prepare()
Date: Fri, 4 Dec 2026 22:30:08 +0100 [thread overview]
Message-ID: <20261204213007.75373-2-blum@kernel.org> (raw)
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);
next reply other threads:[~2026-12-04 21:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 21:30 Thorsten Blum [this message]
2026-12-05 1:50 ` [PATCH bpf-next v2] bpf: Use isdigit() in bpf_bprintf_prepare() patchwork-bot+netdevbpf
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=20261204213007.75373-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.