All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dhiraj Shah" <find.dhiraj@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Add kernel-doc for arena page kfuncs
Date: Thu, 21 May 2026 04:44:28 +0000	[thread overview]
Message-ID: <20260521044428.A67AB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260521043553.199781-1-find.dhiraj@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The kernel-doc for bpf_arena_alloc_pages() incorrectly states that it returns a "Kernel pointer", when it actually returns a user-space virtual address.
--

commit 8a97e4811ec22b9983c311e1250cbacc95c0359e
Author: Dhiraj Shah <find.dhiraj@gmail.com>

bpf: Add kernel-doc for arena page kfuncs

This patch adds kernel-doc comments for the BPF arena page-management
kfuncs. It also updates the documentation to render these blocks in a new
subsection within Documentation/bpf/kfuncs.rst.

[ ... ]

> diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
> index 49a8f7b1beef5..b8ec2953dee68 100644
> --- a/kernel/bpf/arena.c
> +++ b/kernel/bpf/arena.c
> @@ -870,6 +870,33 @@ static void arena_free_irq(struct irq_work *iw)
>  
>  __bpf_kfunc_start_defs();
>  
> +/**
> + * bpf_arena_alloc_pages() - Allocate pages within a BPF arena.

[ ... ]

> + * The underlying allocator may sleep, so this kfunc is only callable from
> + * sleepable BPF programs.
> + *
> + * Return:
> + * * Kernel pointer to the start of the allocated region on success.

[Severity: Low]
Does this kfunc actually return a kernel pointer? 

Looking at arena_alloc_pages(), it appears to return a user-space virtual
address derived directly from the arena's user_vm_start:

kernel/bpf/arena.c:arena_alloc_pages() {
        ...
        return clear_lo32(arena->user_vm_start) + uaddr32;
}

Additionally, the kernel-doc for bpf_arena_free_pages() added in this same
patch notes that the pointer is returned "in user-space form" by
bpf_arena_alloc_pages(). Should this documentation be updated to state that
it returns a user-space pointer rather than a kernel pointer?

> + * * %NULL if @p__map is not an arena, @flags is non-zero, @page_cnt is zero
> + *   or exceeds the arena size, @addr__ign is misaligned or outside the
> + *   arena, @node_id is invalid, or the kernel is out of memory.
> + */
>  __bpf_kfunc void *bpf_arena_alloc_pages(void *p__map, void *addr__ign, u32 page_cnt,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260521043553.199781-1-find.dhiraj@gmail.com?part=1

  reply	other threads:[~2026-05-21  4:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  4:35 [PATCH bpf-next] bpf: Add kernel-doc for arena page kfuncs Dhiraj Shah
2026-05-21  4:44 ` sashiko-bot [this message]
2026-05-21  4:56 ` Emil Tsalapatis
2026-05-21  5:15 ` bot+bpf-ci
2026-05-21  5:28 ` Alexei Starovoitov
2026-05-24 11:42 ` [PATCH bpf-next v2] " Dhiraj Shah
2026-05-24 11:56   ` sashiko-bot
2026-05-24 12:23   ` bot+bpf-ci
2026-05-25 16:36   ` bot+bpf-ci
2026-05-25 20:50   ` Alexei Starovoitov

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=20260521044428.A67AB1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=find.dhiraj@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.