BPF List
 help / color / mirror / Atom feed
From: Florian Lehner <dev@der-flo.net>
To: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: check max_entries before allocating memory
Date: Wed, 26 Oct 2022 12:03:12 +0200	[thread overview]
Message-ID: <Y1kF4D4/19DOb/SS@der-flo.net> (raw)
In-Reply-To: <20221026085053.76561-1-dev@der-flo.net>

On Wed, Oct 26, 2022 at 10:50:53AM +0200, Florian Lehner wrote:
> For maps of type BPF_MAP_TYPE_CPUMAP memory is allocated first before
> checking the max_entries argument. If then max_entries is greater than
> NR_CPUS additional work needs to be done to free allocated memory before
> an error is returned.
> This changes moves the check on max_entries before the allocation
> happens.
> 
> Signed-off-by: Florian Lehner <dev@der-flo.net>

I did have a look at the failing CI tests:

Running bpftool checks...
  Comparing /tmp/work/bpf/bpf/tools/include/uapi/linux/bpf.h (bpf_map_type)
  and /tmp/work/bpf/bpf/tools/bpf/bpftool/map.c (do_help() TYPE):
  {'cgroup_storage', 'cgroup_storage_deprecated'}
  Comparing /tmp/work/bpf/bpf/tools/include/uapi/linux/bpf.h (bpf_map_type)
  and /tmp/work/bpf/bpf/tools/bpf/bpftool/Documentation/bpftool-map.rst (TYPE):
  {'cgroup_storage', 'cgroup_storage_deprecated'}
  bpftool checks returned 1.

It looks to me these were introduced with commit
a48b4bf994296a380f9c79620ad4ee7bad4511e1 and are not related to this
proposed change.

  reply	other threads:[~2022-10-26 10:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  8:50 [PATCH bpf-next] bpf: check max_entries before allocating memory Florian Lehner
2022-10-26 10:03 ` Florian Lehner [this message]
2022-10-26 19:21 ` Martin KaFai Lau

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=Y1kF4D4/19DOb/SS@der-flo.net \
    --to=dev@der-flo.net \
    --cc=bpf@vger.kernel.org \
    /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