[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzaEjv1Nc6VK9sAW2y3cGvyKx9WUpOugWn6vZkFW-k7wCA@mail.gmail.com>
Date: Mon, 6 Oct 2025 16:23:34 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Rong Tao <rtoax@...mail.com>
Cc: vmalik@...hat.com, ast@...nel.org, Rong Tao <rongtao@...tc.cn>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Shuah Khan <shuah@...nel.org>,
"open list:BPF [GENERAL] (Safe Dynamic Programs and Tools)" <bpf@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 1/2] bpf: add bpf_strcasestr,bpf_strncasestr kfuncs
On Sat, Oct 4, 2025 at 7:52 AM Rong Tao <rtoax@...mail.com> wrote:
>
> From: Rong Tao <rongtao@...tc.cn>
>
> bpf_strcasestr() and bpf_strncasestr() functions perform same like
> bpf_strstr() and bpf_strnstr() except ignoring the case of the
> characters.
>
> Signed-off-by: Rong Tao <rongtao@...tc.cn>
> ---
> kernel/bpf/helpers.c | 96 ++++++++++++++++++++++++++++++++++----------
> 1 file changed, 75 insertions(+), 21 deletions(-)
>
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index c9fab9a356df..4df902e5f208 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -3675,34 +3675,20 @@ __bpf_kfunc int bpf_strcspn(const char *s__ign, const char *reject__ign)
> return -EFAULT;
> }
>
> -/**
> - * bpf_strnstr - Find the first substring in a length-limited string
> - * @s1__ign: The string to be searched
> - * @s2__ign: The string to search for
> - * @len: the maximum number of characters to search
> - *
> - * Return:
> - * * >=0 - Index of the first character of the first occurrence of @s2__ign
> - * within the first @len characters of @s1__ign
> - * * %-ENOENT - @s2__ign not found in the first @len characters of @s1__ign
> - * * %-EFAULT - Cannot read one of the strings
> - * * %-E2BIG - One of the strings is too large
> - * * %-ERANGE - One of the strings is outside of kernel address space
> - */
> -__bpf_kfunc int bpf_strnstr(const char *s1__ign, const char *s2__ign, size_t len)
> +int __bpf_strnstr(const char *s1, const char *s2, size_t len, bool ignore_case)
keep it static?
pw-bot: cr
[...]
Powered by blists - more mailing lists