* zhong jiang <zhongji...@huawei.com> wrote:

> when shift expoment is negative, left shift alway zero. therefore, we
> modify the logic to avoid the warining.
> 
> Signed-off-by: zhong jiang <zhongji...@huawei.com>
> ---
>  arch/x86/include/asm/futex.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/futex.h b/arch/x86/include/asm/futex.h
> index b4c1f54..2425fca 100644
> --- a/arch/x86/include/asm/futex.h
> +++ b/arch/x86/include/asm/futex.h
> @@ -49,8 +49,12 @@ static inline int futex_atomic_op_inuser(int encoded_op, 
> u32 __user *uaddr)
>       int cmparg = (encoded_op << 20) >> 20;
>       int oldval = 0, ret, tem;
>  
> -     if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
> -             oparg = 1 << oparg;
> +     if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {
> +             if (oparg >= 0)
> +                     oparg = 1 << oparg;
> +             else
> +                     oparg = 0;
> +     }

Could we avoid all these complications by using an unsigned type?

Thanks,

        Ingo

Reply via email to