BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Hao" <flyingpenghao@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] bpf: Bound the resizable hashtab batch buffers by max_entries
Date: Wed, 02 Dec 2026 05:43:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-244923@kernel.org> (raw)
In-Reply-To: <20261202053720.92474-1-flyingpeng@tencent.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: incorrect Fixes tag for
  __rhtab_map_lookup_and_delete_batch()
--

commit 9770249174f01abb3a3d1236fe3c14f234ab367c
Author: Peng Hao <flyingpenghao@gmail.com>

> bpf: Bound the resizable hashtab batch buffers by max_entries
>
> __rhtab_map_lookup_and_delete_batch() allocates the key, value and
> element pointer buffers for attr->batch.count entries before it looks at
> the map. count comes straight from userspace and is not limited by the
> size of the map, so a lookup batch on a one-element map with a 4K value
> and count = 65536 has the kernel allocate about 257 MB, and
> count = 1048576 asks for about 4 GB and fails with -ENOMEM instead of
> returning the element.
>
> A batch never returns more than max_entries elements, so clamp the
> buffer size to that. The regular hash map sizes its buffers by bucket
> size instead, so it doesn't have this problem.
>
> Fixes: 16b4d3e2fb24 ("bpf: Implement resizable hashmap basic functions")
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>

[Severity: Low]
__rhtab_map_lookup_and_delete_batch() was introduced in 818e00848227
("bpf: Implement iteration ops for resizable hashtab") rather than
16b4d3e2fb24 ("bpf: Implement resizable hashmap basic functions").  Should
the Fixes tag be updated to:

  Fixes: 818e00848227 ("bpf: Implement iteration ops for resizable hashtab")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202053720.92474-1-flyingpeng@tencent.com?part=1

      reply	other threads:[~2026-12-02  5:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  5:37 [PATCH] bpf: Bound the resizable hashtab batch buffers by max_entries Peng Hao
2026-12-02  5:43 ` sashiko-bot [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=sashiko-outbox-244923@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=flyingpenghao@gmail.com \
    --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