vfio/mlx5: fix possible overflow in tracking max message size
authorArtem Sadovnikov <a.sadovnikov@ispras.ru>
Tue, 1 Jul 2025 14:40:17 +0000 (14:40 +0000)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 15 Jul 2025 20:17:17 +0000 (14:17 -0600)
commitb3060198483bac43ec113c62ae3837076f61f5de
tree9d90f7b53bed93ea2ecd7ab0fc4a01bd9422f81a
parente908f58b6beb337cbe4481d52c3f5c78167b1aab
vfio/mlx5: fix possible overflow in tracking max message size

MLX cap pg_track_log_max_msg_size consists of 5 bits, value of which is
used as power of 2 for max_msg_size. This can lead to multiplication
overflow between max_msg_size (u32) and integer constant, and afterwards
incorrect value is being written to rq_size.

Fix this issue by extending integer constant to u64 type.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Artem Sadovnikov <a.sadovnikov@ispras.ru>
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/20250701144017.2410-2-a.sadovnikov@ispras.ru
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/mlx5/cmd.c