Re: [PATCH] bpftool: Fix undefined behavior caused by shifting into the sign bit

From: Quentin Monnet
Date: Sun Sep 08 2024 - 15:48:55 EST


On 08/09/2024 15:00, Kuan-Wei Chiu wrote:
> Replace shifts of '1' with '1U' in bitwise operations within
> __show_dev_tc_bpf() to prevent undefined behavior caused by shifting
> into the sign bit of a signed integer. By using '1U', the operations
> are explicitly performed on unsigned integers, avoiding potential
> integer overflow or sign-related issues.
>
> Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>


Looks good, thank you.

Acked-by: Quentin Monnet <qmo@xxxxxxxxxx>

How did you find these?