mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: abhishekkhade69@gmail.com,bpf@vger.kernel.org
Cc: ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,memxor@gmail.com,linux-kernel@vger.kernel.org,abhishekkhade69@gmail.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [RFC PATCH bpf-next 2/2] selftests/bpf: Add selftests for bpf_memmem and bpf_dynptr_memmem kfuncs
Date: Sun, 22 Nov 2026 11:26:08 +0000 (UTC)	[thread overview]
Message-ID: <47fe648c11a1926326e2c6ac5fa1275b8eaab628d352c192811051516e36e54b@mail.kernel.org> (raw)
In-Reply-To: <20261122103838.244974-3-abhishekkhade69@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

> selftests/bpf: Add selftests for bpf_memmem and bpf_dynptr_memmem kfuncs

TL;DR: Nit only, in the memmem selftests: the (void *) casts in the
bpf_dynptr_from_mem() calls may be unnecessary, since the arrays aren't const
and other callers omit them.

> diff --git a/tools/testing/selftests/bpf/progs/memmem_kfunc.c b/tools/testing/selftests/bpf/progs/memmem_kfunc.c
> new file mode 100644
> index 000000000000..8abd06e9758d
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/memmem_kfunc.c

[ ... ]

> +SEC("syscall")
> +__success __retval(7)
> +int test_dynptr_memmem_embedded_null(void *ctx)
> +{
> +	struct bpf_dynptr ptr;
> +
> +	bpf_dynptr_from_mem((void *)bin_data, sizeof(bin_data), 0, &ptr);
> +	return bpf_dynptr_memmem(&ptr, needle_null, sizeof(needle_null), 0);
> +}

this isn't a bug, but are the (void *) casts needed in the
bpf_dynptr_from_mem() calls?

bin_data, needle_start and oversized_buf are not const, so they convert to
void * implicitly.  The bpf_memmem() calls earlier in this file pass the
same arrays without a cast, and dynptr_success.c passes map_val directly.

Dropping the casts would match those callers.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45015018001

      reply	other threads:[~2026-11-22 11:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 10:38 [RFC PATCH bpf-next 0/2] bpf: Add " Abhishek Khade
2026-11-22 10:38 ` [RFC PATCH bpf-next 1/2] " Abhishek Khade
2026-11-22 11:26   ` bot+bpf-ci
2026-11-22 10:38 ` [RFC PATCH bpf-next 2/2] selftests/bpf: Add selftests for " Abhishek Khade
2026-11-22 11:26   ` bot+bpf-ci [this message]

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=47fe648c11a1926326e2c6ac5fa1275b8eaab628d352c192811051516e36e54b@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=abhishekkhade69@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®