Files
kernel_realme_nemo/include/linux
Kees Cook f16367436f net/mlx4_core: Avoid impossible mlx4_db_alloc() order value
[ Upstream commit 4a6f18f28627e121bd1f74b5fcc9f945d6dbeb1e ]

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>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
2025-12-24 11:23:53 +00:00
..
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2025-12-24 11:16:57 +00:00
2022-08-17 15:18:46 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2022-10-26 13:17:05 +02:00
2025-09-21 09:20:40 +00:00
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2023-10-31 18:44:28 +05:30
2020-03-03 00:04:10 +08:00
2025-12-24 11:20:53 +00:00
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2023-12-20 15:32:35 +01:00
2018-09-26 08:42:37 +02:00
2019-11-24 08:22:48 +01:00
2021-12-08 08:46:55 +01:00
2025-08-27 18:27:49 +05:30
2021-12-25 18:03:37 +05:30
2020-04-02 16:34:21 +02:00
2021-12-25 18:03:37 +05:30
2020-03-03 00:04:10 +08:00
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-03-03 18:58:56 +01:00
2020-01-13 19:40:11 +00:00
2019-12-17 21:13:36 +01:00
2021-03-03 18:58:56 +01:00
2022-08-25 11:11:25 +02:00
2021-02-07 14:47:41 +01:00
2020-09-09 19:35:54 +02:00
2025-09-21 09:20:40 +00:00
2021-12-25 18:03:37 +05:30
2019-12-31 12:37:21 +01:00
2021-12-25 18:03:37 +05:30
2021-07-11 12:48:09 +02:00
2025-12-24 11:23:09 +00:00
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2020-06-16 12:53:13 -07:00
2020-03-20 10:54:12 +01:00
2019-08-12 13:29:46 -04:00
2021-12-25 18:03:37 +05:30
2020-06-05 16:00:11 +08:00
2021-12-25 18:03:37 +05:30
2025-12-24 11:23:19 +00:00
2019-06-11 12:21:48 +02:00
2023-11-28 16:45:44 +00:00
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30
2020-04-02 16:34:36 +02:00
2021-12-25 18:03:37 +05:30
2020-08-01 00:48:35 +08:00
2020-01-09 14:58:35 -08:00
2025-12-24 11:20:53 +00:00
2018-11-13 11:15:11 -08:00
2021-12-25 18:03:37 +05:30
2025-12-24 11:16:57 +00:00
2018-09-10 09:21:07 +02:00
2021-12-25 18:03:37 +05:30
2020-04-02 16:34:36 +02:00
2021-12-14 10:16:55 +01:00
2021-12-25 18:03:37 +05:30
2021-12-25 18:03:37 +05:30