Kees Cook and Greg Kroah-Hartman
50c5bbb45c
net/mlx4_core: Avoid impossible mlx4_db_alloc() order value
...
[ Upstream commit 4a6f18f286 ]
GCC can see that the value range for "order" is capped, but this leads
it to consider that it might be negative, leading to a false positive
warning (with GCC 15 with -Warray-bounds -fdiagnostics-details):
../drivers/net/ethernet/mellanox/mlx4/alloc.c:691:47: error: array subscript -1 is below array bounds of 'long unsigned int *[2]' [-Werror=array-bounds=]
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o);
| ~~~~~~~~~~~^~~
'mlx4_alloc_db_from_pgdir': events 1-2
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | | | (2) out of array bounds here
| (1) when the condition is evaluated to true In file included from ../drivers/net/ethernet/mellanox/mlx4/mlx4.h:53,
from ../drivers/net/ethernet/mellanox/mlx4/alloc.c:42:
../include/linux/mlx4/device.h:664:33: note: while referencing 'bits'
664 | unsigned long *bits[2];
| ^~~~
Switch the argument to unsigned int, which removes the compiler needing
to consider negative values.
Signed-off-by: Kees Cook <kees@kernel.org >
Link: https://patch.msgid.link/20250210174504.work.075-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-05-29 11:02:49 +02:00
..
2025-01-17 13:40:59 +01:00
2025-04-25 10:47:38 +02:00
2024-12-19 18:13:14 +01:00
2024-12-14 20:03:12 +01:00
2024-12-14 20:03:26 +01:00
2025-05-29 11:02:43 +02:00
2025-05-29 11:02:49 +02:00
2025-05-29 11:02:40 +02:00
2024-12-14 20:03:40 +01:00
2025-02-17 10:04:53 +01:00
2025-02-27 04:30:17 -08:00
2025-04-10 14:39:28 +02:00
2025-03-07 18:25:27 +01:00
2025-02-08 09:58:15 +01:00
2024-12-27 14:02:13 +01:00
2024-12-27 14:01:57 +01:00
2025-04-25 10:47:49 +02:00
2025-02-17 10:04:43 +01:00
2025-05-22 14:29:49 +02:00
2025-05-02 07:58:54 +02:00
2025-04-25 10:48:08 +02:00
2025-04-25 10:48:07 +02:00
2025-05-29 11:02:17 +02:00
2025-04-25 10:48:07 +02:00
2025-02-08 09:57:30 +01:00
2025-05-29 11:02:00 +02:00
2025-02-17 10:05:06 +01:00
2025-04-20 10:15:04 +02:00
2025-04-20 10:15:04 +02:00
2024-12-14 20:03:38 +01:00
2024-12-14 20:04:16 +01:00
2025-03-13 13:01:58 +01:00
2024-12-05 14:02:45 +01:00
2024-12-05 14:02:45 +01:00
2025-03-07 18:25:35 +01:00
2025-03-07 18:25:36 +01:00
2025-04-10 14:39:28 +02:00
2025-02-08 09:56:49 +01:00
2025-04-10 14:39:22 +02:00
2025-05-18 08:24:59 +02:00
2025-05-09 09:50:35 +02:00
2025-05-29 11:01:59 +02:00
2024-12-14 20:04:09 +01:00
2025-02-21 14:01:34 +01:00
2025-05-02 07:58:52 +02:00
2025-03-13 13:02:07 +01:00
2024-12-14 20:03:35 +01:00
2025-05-18 08:24:59 +02:00
2025-02-08 09:57:05 +01:00
2024-12-14 20:03:12 +01:00
2024-12-14 20:03:48 +01:00
2025-01-09 13:33:47 +01:00
2025-03-22 12:54:20 -07:00
2025-04-10 14:39:17 +02:00
2025-04-20 10:15:29 +02:00
2024-12-05 14:01:18 +01:00
2025-02-17 10:05:31 +01:00
2025-01-23 17:23:03 +01:00
2025-03-22 12:54:28 -07:00
2025-05-22 14:29:48 +02:00
2025-05-18 08:24:48 +02:00
2025-01-09 13:33:42 +01:00
2024-12-05 14:01:35 +01:00
2025-04-10 14:39:12 +02:00
2025-04-20 10:15:40 +02:00
2024-12-27 14:02:17 +01:00
2025-01-17 13:40:34 +01:00
2025-05-09 09:50:34 +02:00
2025-05-29 11:02:23 +02:00
2024-12-05 14:01:22 +01:00
2025-02-08 09:57:58 +01:00
2024-12-09 10:41:08 +01:00
2025-03-28 22:03:30 +01:00
2024-12-05 14:03:03 +01:00
2025-05-22 14:29:36 +02:00
2024-12-14 20:04:01 +01:00
2025-03-28 22:03:27 +01:00
2024-12-05 14:02:46 +01:00
2025-05-29 11:02:25 +02:00
2024-11-11 00:00:37 -08:00
2025-01-09 13:33:54 +01:00
2025-01-09 13:33:54 +01:00
2025-01-09 13:33:54 +01:00
2024-12-05 14:03:08 +01:00
2024-11-07 14:14:58 -08:00
2025-05-18 08:24:59 +02:00
2025-01-17 13:40:50 +01:00
2025-02-08 09:57:23 +01:00
2025-05-29 11:02:41 +02:00
2024-12-19 18:13:19 +01:00
2025-02-27 04:30:18 -08:00
2025-01-17 13:40:35 +01:00
2024-12-05 14:02:01 +01:00
2025-02-08 09:57:59 +01:00
2025-04-10 14:39:24 +02:00
2025-04-25 10:47:50 +02:00
2024-12-05 14:02:27 +01:00
2025-04-10 14:39:11 +02:00
2025-03-13 13:02:03 +01:00
2025-03-13 13:02:01 +01:00
2024-12-05 14:01:32 +01:00
2024-12-05 14:03:08 +01:00
2024-12-05 14:03:08 +01:00
2025-04-20 10:15:50 +02:00
2025-04-20 10:15:25 +02:00
2025-05-29 11:02:04 +02:00
2025-05-02 07:58:56 +02:00
2025-04-20 10:15:10 +02:00
2025-04-20 10:15:49 +02:00
2025-03-13 13:02:07 +01:00
2025-03-13 13:02:07 +01:00
2025-04-10 14:39:11 +02:00
2025-05-29 11:02:20 +02:00
2025-01-23 17:22:57 +01:00
2025-02-08 09:58:16 +01:00
2025-04-20 10:15:12 +02:00
2025-03-28 22:03:30 +01:00
2025-01-23 17:22:53 +01:00
2025-02-08 09:57:07 +01:00
2025-04-10 14:39:28 +02:00
2025-03-07 18:25:43 +01:00
2024-12-05 14:01:23 +01:00
2024-12-14 20:03:18 +01:00
2025-03-13 13:01:58 +01:00
2025-02-01 18:39:35 +01:00
2024-12-05 14:01:23 +01:00
2025-02-27 04:30:14 -08:00
2025-02-08 09:57:07 +01:00
2025-02-27 04:30:19 -08:00
2025-03-07 18:25:32 +01:00
2024-11-13 19:29:46 -08:00
2024-12-05 14:01:23 +01:00
2024-12-14 20:03:32 +01:00
2024-12-19 18:13:24 +01:00
2025-04-10 14:39:26 +02:00
2024-12-14 20:04:16 +01:00
2025-05-22 14:29:50 +02:00
2025-04-10 14:39:35 +02:00
2025-05-29 11:02:04 +02:00
2025-05-29 11:02:04 +02:00
2025-05-18 08:24:56 +02:00
2025-04-10 14:39:37 +02:00
2024-11-07 14:14:59 -08:00
2025-01-23 17:23:02 +01:00
2024-12-09 10:41:06 +01:00
2025-05-22 14:29:38 +02:00
2024-11-11 00:00:37 -08:00
2025-05-18 08:24:51 +02:00
2025-01-02 10:34:10 +01:00
2024-12-27 14:02:20 +01:00
2025-01-17 13:40:33 +01:00