]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: drv-net: fix RPS mask handling for high CPU numbers
authorGal Pressman <gal@nvidia.com>
Mon, 12 Jan 2026 17:37:15 +0000 (19:37 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 14 Jan 2026 03:13:08 +0000 (19:13 -0800)
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: 5ebfb4cc3048 ("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>
tools/testing/selftests/drivers/net/hw/toeplitz.c

index d23b3b0c20a36d1d652f6408d5616ff4fb6327c4..285bb17df9c2f875c6073b8a0fa2619007b62962 100644 (file)
@@ -485,8 +485,8 @@ static void parse_rps_bitmap(const char *arg)
 
        bitmap = strtoul(arg, NULL, 0);
 
-       if (bitmap & ~(RPS_MAX_CPUS - 1))
-               error(1, 0, "rps bitmap 0x%lx out of bounds 0..%lu",
+       if (bitmap & ~((1UL << RPS_MAX_CPUS) - 1))
+               error(1, 0, "rps bitmap 0x%lx out of bounds, max cpu %lu",
                      bitmap, RPS_MAX_CPUS - 1);
 
        for (i = 0; i < RPS_MAX_CPUS; i++)