BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v3] bpftool: Compute map size of light skeletons at runtime
Date: Tue, 15 Sep 2026 16:28:34 +0000	[thread overview]
Message-ID: <20260915162834.E2B751F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915161450.96249-1-leon.hwang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] bpf: compilation failure in skel_internal.h due to non-standard roundup macro
--

commit cf9410def9715a95832e67f7002ebd4dabf2d7ad
Author: Leon Hwang <leon.hwang@linux.dev>

bpftool: Compute map size of light skeletons at runtime

This commit addresses an issue with generating light skeletons on
a host with a different page size from the target. It accomplishes
this by passing the original map dimensions and dynamically computing
the mmap size at runtime.

> diff --git a/tools/lib/bpf/skel_internal.h b/tools/lib/bpf/skel_internal.h
> index 1f3f332dffbe9..9e16b8e8cb7c9 100644
> --- a/tools/lib/bpf/skel_internal.h
> +++ b/tools/lib/bpf/skel_internal.h
[ ... ]
> @@ -193,25 +197,39 @@ static inline void skel_free(void *p)
>  	free(p);
>  }
>  
> -static inline void skel_free_map_data(void *p, __u64 addr, size_t sz)
> +static inline size_t skel_map_mmap_sz(size_t val_sz, __u32 max_entries)
>  {
> -	munmap(p, sz);
> +	const long page_sz = sysconf(_SC_PAGE_SIZE);
> +	size_t mmap_sz;
> +
> +	mmap_sz = roundup(val_sz, 8) * max_entries;
> +	mmap_sz = roundup(mmap_sz, page_sz);

[Severity: Low]
Does this code rely on the non-standard roundup macro from <sys/param.h>?

When users include the generated light skeleton header in a project compiled
with strict C standards (e.g., -std=c99 or -std=c11) without _DEFAULT_SOURCE
or _GNU_SOURCE, the roundup macro might not be defined. This can cause a
compilation error due to an implicit declaration of function.

> +	return mmap_sz;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915161450.96249-1-leon.hwang@linux.dev?part=1

  reply	other threads:[~2026-09-15 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 16:14 [PATCH bpf-next v3] bpftool: Compute map size of light skeletons at runtime Leon Hwang
2026-09-15 16:28 ` sashiko-bot [this message]
2026-09-16 14:56   ` Leon Hwang
2026-09-15 16:53 ` bot+bpf-ci
2026-09-17 11:24 ` Quentin Monnet
2026-09-21 21:20 ` patchwork-bot+netdevbpf

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=20260915162834.E2B751F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leon.hwang@linux.dev \
    --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