Re: [PATCHv4 bpf-next 2/5] libbpf: Add support to detect nop,nop5 instructions combo for usdt probe
From: David Laight
Date: Sat Feb 21 2026 - 07:00:47 EST
On Fri, 20 Feb 2026 11:24:45 +0000 (UTC)
bot+bpf-ci@xxxxxxxxxx wrote:
> > diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
> > index d1524f6f54ae..c81e0a58caf5 100644
> > --- a/tools/lib/bpf/usdt.c
> > +++ b/tools/lib/bpf/usdt.c
>
> [ ... ]
>
> > +#if defined(__x86_64__)
> > +static bool has_nop_combo(int fd, long off)
> > +{
> > + static unsigned char nop_combo[6] = {
> ^^^^^^^^^^^^^^^^^^^^^^
>
> Should nop_combo be declared const? It is a read-only lookup table
> used only in the memcmp() below.
Actually you either want 'static const unsigned char' or just 'unsigned char'.
In either case gcc optimises away the array, the call to memcmp(), and
just compares with 32bit and 64bit constants.
>
> > + 0x90, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nop,nop5 */
> > + };
> > + unsigned char buf[6] = {};
No need to initialise buf[];
David
> > +
> > + if (pread(fd, buf, 6, off) != 6)
> > + return false;
> > + return memcmp(buf, nop_combo, 6) == 0;
> > +}
>
> [ ... ]
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/22221513473
>
> AI-authorship-score: low
> AI-authorship-explanation: Domain-specific optimization from established BPF/tracing maintainer with iterative lore review history and deep x86_64 uprobe internals knowledge.
> issues-found: 1
> issue-severity-score: low
> issue-severity-explanation: Missing const qualifier on a static read-only byte array is a minor C best practice deviation with no runtime impact.