* [bug report] net/mlx5: DR, Move STEv0 setters and getters
@ 2021-01-08 13:16 Dan Carpenter
2021-01-20 0:52 ` Yevgeny Kliteynik
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-01-08 13:16 UTC (permalink / raw)
To: kernel-janitors
Hello Yevgeny Kliteynik,
The patch 6b93b400aa88: "net/mlx5: DR, Move STEv0 setters and
getters" from Nov 19, 2020, leads to the following static checker
warning:
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c:252 dr_ste_v0_get_miss_addr()
warn: potential shift truncation. '0xff (0-255) << 26'
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
248 static u64 dr_ste_v0_get_miss_addr(u8 *hw_ste_p)
249 {
250 u64 index 251 (MLX5_GET(ste_rx_steering_mult, hw_ste_p, miss_address_31_6) |
252 MLX5_GET(ste_rx_steering_mult, hw_ste_p, miss_address_39_32) << 26);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is shifting a u32 value in the 0-255 range by << 26 which could
result in shift wrapping. "index" is a u64 but ORing two u32 values
will result in a u32.
253
254 return index << 6;
255 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] net/mlx5: DR, Move STEv0 setters and getters
2021-01-08 13:16 [bug report] net/mlx5: DR, Move STEv0 setters and getters Dan Carpenter
@ 2021-01-20 0:52 ` Yevgeny Kliteynik
0 siblings, 0 replies; 2+ messages in thread
From: Yevgeny Kliteynik @ 2021-01-20 0:52 UTC (permalink / raw)
To: kernel-janitors
On 08-Jan-21 15:16, Dan Carpenter wrote:
>
> The patch 6b93b400aa88: "net/mlx5: DR, Move STEv0 setters and
> getters" from Nov 19, 2020, leads to the following static checker
> warning:
>
> drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c:252 dr_ste_v0_get_miss_addr()
> warn: potential shift truncation. '0xff (0-255) << 26'
>
> drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c
> 248 static u64 dr_ste_v0_get_miss_addr(u8 *hw_ste_p)
> 249 {
> 250 u64 index > 251 (MLX5_GET(ste_rx_steering_mult, hw_ste_p, miss_address_31_6) |
> 252 MLX5_GET(ste_rx_steering_mult, hw_ste_p, miss_address_39_32) << 26);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This is shifting a u32 value in the 0-255 range by << 26 which could
> result in shift wrapping. "index" is a u64 but ORing two u32 values
> will result in a u32.
Thanks Dan, will send a fix shortly.
-- YK
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-20 0:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-08 13:16 [bug report] net/mlx5: DR, Move STEv0 setters and getters Dan Carpenter
2021-01-20 0:52 ` Yevgeny Kliteynik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox