Thread (4 messages) 4 messages, 4 authors, 2025-01-18

Re: [PATCH][next] net/mlx5: fix unintentional sign extension on shift of dest_attr->vport.vhca_id

From: Moshe Shemesh <hidden>
Date: 2025-01-17 11:44:45
Also in: kernel-janitors, linux-rdma, lkml


On 1/16/2025 8:17 PM, Colin Ian King wrote:
Shifting dest_attr->vport.vhca_id << 16 results in a promotion from an
unsigned 16 bit integer to a 32 bit signed integer, this is then sign
extended to a 64 bit unsigned long on 64 bitarchitectures. If vhca_id is
greater than 0x7fff then this leads to a sign extended result where all
the upper 32 bits of idx are set to 1. Fix this by casting vhca_id
to the same type as idx before performing the shift.

Fixes: 8e2e08a6d1e0 ("net/mlx5: fs, add support for dest vport HWS action")
Signed-off-by: Colin Ian King<redacted>
Acked-by: Moshe Shemesh <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help