bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tobias Philipp" <tphilipp@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/4] bpf: Align lpm_trie map values to 8 bytes
Date: Tue, 24 Nov 2026 22:56:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-232176@kernel.org> (raw)
In-Reply-To: <20261124225055.87344-3-tphilipp@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: non-standard multi-line comment style in trie_alloc()
--

commit 7745369351fba1841a655972ae45f1b4be10934b
Author: Tobias Philipp <tphilipp@gmail.com>

bpf: Align lpm_trie map values to 8 bytes

This commit rounds lpm_trie's data_size up to a multiple of 8 bytes when
computing the value offset and node size so that map values are 8-byte
aligned.

> diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
> index 4d6f25db9ba12..44ad5c1630006 100644
> --- a/kernel/bpf/lpm_trie.c
> +++ b/kernel/bpf/lpm_trie.c

[ ... ]

> @@ -597,8 +597,14 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr)
>  
>  	raw_res_spin_lock_init(&trie->lock);
>  
> -	/* Allocate intermediate and leaf nodes from the same allocator */
> -	leaf_size = sizeof(struct lpm_trie_node) + trie->data_size +
> +	/* Allocate intermediate and leaf nodes from the same allocator.
> +	 * The key bytes are padded to a multiple of 8 bytes, because the
> +	 * verifier assumes that map values are 8-byte aligned. Objects from
> +	 * bpf_mem_alloc are 8-byte aligned, so data[] must be as well.
> +	 */

[Severity: Low]
This isn't a bug, but BPF multi-line comment style puts the opening /* on
its own line before the comment text.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124225055.87344-1-tphilipp@gmail.com?part=2

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 22:50 [PATCH bpf-next v2 0/4] bpf: Fix 8-byte alignment of map values Tobias Philipp
2026-11-24 22:50 ` [PATCH bpf-next v2 1/4] bpf: Fix alignment of memory allocator objects on 32-bit archs Tobias Philipp
2026-11-24 22:50 ` [PATCH bpf-next v2 2/4] bpf: Align lpm_trie map values to 8 bytes Tobias Philipp
2026-11-24 22:56   ` sashiko-bot [this message]
2026-11-24 22:50 ` [PATCH bpf-next v2 3/4] bpf: Align devmap " Tobias Philipp
2026-11-24 22:55   ` sashiko-bot
2026-11-24 22:50 ` [PATCH bpf-next v2 4/4] selftests/bpf: Check that map values are 8-byte aligned Tobias Philipp

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-232176@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tphilipp@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).