Re: [PATCH] futex: make FUTEX_OP_OPARG_SHIFT unsigned

From: Thomas Gleixner
Date: Wed Oct 26 2016 - 07:26:02 EST


On Mon, 24 Oct 2016, Jiri Slaby wrote:

> FUTEX_OP_OPARG_SHIFT is shifted left by 28 in futex_atomic_op_inuser and
> other places. Since FUTEX_OP_OPARG_SHIFT is 8, we actually do (8 << 28).
> But given both are ints, we perform operation with undefined behaviour
> about which UBSAN reports:
> UBSAN: Undefined behaviour in arch/x86/include/asm/futex.h:53:13
> shift exponent 776 is too large for 32-bit type 'int'

shift exponent 776 ????

Thanks,
tglx