[PATCH] net/nfp: fix UB in BAR size shift operations
Thomas Monjalon
thomas at monjalon.net
Fri Jul 10 16:38:46 CEST 2026
07/07/2026 16:01, Alexey Simakov:
> The literal '1' is a signed 32-bit int. Shifting it by bar->bitsize
> is undefined behavior when bitsize >= 31, and sign-extends when
> bitsize == 31 (producing a wrong upper-bound check). BAR aperture
> sizes from hardware can exceed this range.
>
> Fix by using RTE_BIT64() which produces a 64-bit unsigned value,
> matching the type of the operands (uint64_t base, uint64_t offset).
>
> Fixes: c7e9729da6b5 ("net/nfp: support CPP")
> Fixes: 1fbe51cd9c3a ("net/nfp: extend usage of BAR from 8 to 24")
> Cc: stable at dpdk.org
>
> Signed-off-by: Alexey Simakov <bigalex934 at gmail.com>
Applied, thanks.
More information about the dev
mailing list