From: sashiko-bot@kernel.org
To: "Ayushman Rout" <ayushmanrout27@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 1/2] bpf: Fix bpf_dynptr_copy() for overlapping ranges in one packet
Date: Mon, 26 Oct 2026 16:41:29 +0000 [thread overview]
Message-ID: <sashiko-outbox-185549@kernel.org> (raw)
In-Reply-To: <20261026162810.12862-2-ayushmanrout27@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] bpf: non-standard multi-line comment style in bpf_dynptr_copy()
--
commit 4a57e7196e830451e2770433571b9c37faffc18b
Author: Ayushman Rout <ayushmanrout27@gmail.com>
bpf: Fix bpf_dynptr_copy() for overlapping ranges in one packet
This commit fixes overlapping copies within the same packet in
bpf_dynptr_copy() by avoiding direct slice buffers when both dynptrs share the
same underlying data and copying chunks in reverse when the destination is
above the source.
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index 648abe1ba63ae..b74c03669b5fd 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -3291,8 +3291,10 @@ __bpf_kfunc int bpf_dynptr_copy(const struct bpf_dynptr *dst_ptr, u64 dst_off,
> {
> const struct bpf_dynptr_kern *dst = (struct bpf_dynptr_kern *)dst_ptr;
> const struct bpf_dynptr_kern *src = (struct bpf_dynptr_kern *)src_ptr;
> + bool same = src->data == dst->data;
> void *src_slice, *dst_slice;
> char buf[256];
> + bool rev;
> u64 off;
>
> src_slice = bpf_dynptr_slice(src_ptr, src_off, NULL, size);
> @@ -3303,25 +3305,31 @@ __bpf_kfunc int bpf_dynptr_copy(const struct bpf_dynptr *dst_ptr, u64 dst_off,
> return 0;
> }
>
> - if (src_slice)
> + /* The other range is copied piece by piece. A slice of the same packet
> + * may overlap with it, so it cannot be the buffer for that.
> + */
[Severity: Low]
This isn't a bug, but in bpf_dynptr_copy() in kernel/bpf/helpers.c, could this
new multi-line comment follow the BPF subsystem comment style with the opening
/* on its own line:
/*
* The other range is copied piece by piece. A slice of the same packet
* may overlap with it, so it cannot be the buffer for that.
*/
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261026162810.12862-1-ayushmanrout27@gmail.com?part=1
next prev parent reply other threads:[~2026-10-26 16:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 16:28 [PATCH bpf v2 0/2] bpf: Fix overlapping copies in bpf_dynptr_copy() Ayushman Rout
2026-10-26 16:28 ` [PATCH bpf v2 1/2] bpf: Fix bpf_dynptr_copy() for overlapping ranges in one packet Ayushman Rout
2026-10-26 16:41 ` sashiko-bot [this message]
2026-10-26 16:28 ` [PATCH bpf v2 2/2] selftests/bpf: Test overlapping dynptr copies on xdp frags Ayushman Rout
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=sashiko-outbox-185549@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ayushmanrout27@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.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