Re: [PATCH] RDMA/mlx5: Prevent UB from shifting negative signed value
From: Leon Romanovsky
Date: Thu Mar 06 2025 - 03:24:11 EST
On Tue, 04 Mar 2025 14:02:46 +0000, Qasim Ijaz wrote:
> In function create_ib_ah() the following line attempts
> to left shift the return value of mlx5r_ib_rate() by 4
> and store it in the stat_rate_sl member of av:
>
> ah->av.stat_rate_sl = (mlx5r_ib_rate(dev, rdma_ah_get_static_rate(ah_attr)) << 4);
>
> However the code overlooks the fact that mlx5r_ib_rate()
> may return -EINVAL if the rate passed to it is less than
> IB_RATE_2_5_GBPS or greater than IB_RATE_800_GBPS.
>
> [...]
Applied, thanks!
[1/1] RDMA/mlx5: Prevent UB from shifting negative signed value
https://git.kernel.org/rdma/rdma/c/556f93b90c1872
Best regards,
--
Leon Romanovsky <leon@xxxxxxxxxx>