lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ee2016b1-926e-93b1-ba92-d5f4975f06c9@gmx.de>
Date:   Tue, 6 Apr 2021 12:08:55 +0200
From:   Helge Deller <deller@....de>
To:     Gao Xiang <xiang@...nel.org>, linux-parisc@...r.kernel.org
Cc:     Liam Beguin <liambeguin@...il.com>, linux-kernel@...r.kernel.org,
        Gao Xiang <hsiangkao@...hat.com>
Subject: Re: [PATCH] parisc: avoid a warning on u8 cast for cmpxchg on u8
 pointers

On 4/6/21 6:59 AM, Gao Xiang wrote:
> From: Gao Xiang <hsiangkao@...hat.com>
>
> commit b344d6a83d01 ("parisc: add support for cmpxchg on u8 pointers")
> can generate a sparse warningi ("cast truncates bits from constant
> value"), which has been reported several times [1] [2] [3].
>
> The original code worked as expected, but anyway, let silence such
> sparse warning as what others did [4].
>
> [1] https://lore.kernel.org/r/202104061220.nRMBwCXw-lkp@intel.com
> [2] https://lore.kernel.org/r/202012291914.T5Agcn99-lkp@intel.com
> [3] https://lore.kernel.org/r/202008210829.KVwn7Xeh%25lkp@intel.com
> [4] https://lore.kernel.org/r/20210315131512.133720-2-jacopo+renesas@jmondi.org
> Cc: Liam Beguin <liambeguin@...il.com>
> Cc: Helge Deller <deller@....de>
> Signed-off-by: Gao Xiang <hsiangkao@...hat.com>

applied to the parisc for-next git tree.
(I fixed up the typo above too)

Thanks!
Helge

> ---
>   arch/parisc/include/asm/cmpxchg.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h
> index cf5ee9b0b393..84ee232278a6 100644
> --- a/arch/parisc/include/asm/cmpxchg.h
> +++ b/arch/parisc/include/asm/cmpxchg.h
> @@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
>   #endif
>   	case 4: return __cmpxchg_u32((unsigned int *)ptr,
>   				     (unsigned int)old, (unsigned int)new_);
> -	case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
> +	case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff);
>   	}
>   	__cmpxchg_called_with_bad_pointer();
>   	return old;
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ