Skip to content

Commit cf055f8

Browse files
gal-pressmankuba-moo
authored andcommitted
selftests: drv-net: fix RPS mask handling for high CPU numbers
The RPS bitmask bounds check uses ~(RPS_MAX_CPUS - 1) which equals ~15 = 0xfff0, only allowing CPUs 0-3. Change the mask to ~((1UL << RPS_MAX_CPUS) - 1) = ~0xffff to allow CPUs 0-15. Fixes: 5ebfb4c ("selftests/net: toeplitz test") Reviewed-by: Nimrod Oren <noren@nvidia.com> Signed-off-by: Gal Pressman <gal@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260112173715.384843-3-gal@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9d48c62 commit cf055f8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/testing/selftests/drivers/net/hw/toeplitz.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ static void parse_rps_bitmap(const char *arg)
485485

486486
bitmap = strtoul(arg, NULL, 0);
487487

488-
if (bitmap & ~(RPS_MAX_CPUS - 1))
489-
error(1, 0, "rps bitmap 0x%lx out of bounds 0..%lu",
488+
if (bitmap & ~((1UL << RPS_MAX_CPUS) - 1))
489+
error(1, 0, "rps bitmap 0x%lx out of bounds, max cpu %lu",
490490
bitmap, RPS_MAX_CPUS - 1);
491491

492492
for (i = 0; i < RPS_MAX_CPUS; i++)

0 commit comments

Comments
 (0)