Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4267561pxf; Tue, 6 Apr 2021 11:58:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq5/dP3qbF1PPnyY5Oz/lviQr5XRYtkerb4EcWduxLDDgNFM1/HXm50pkDv9PqfbGKhcoa X-Received: by 2002:a5d:8453:: with SMTP id w19mr24843420ior.25.1617735484434; Tue, 06 Apr 2021 11:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617735484; cv=none; d=google.com; s=arc-20160816; b=F/9TCQ5VeTzvqVQkj3dBP+RvCEOSBZa84Rr4y+Tn4f5v/90TY7n2CREbSVtGkDJtJn SUXQYIEy3wPyZHJ6oMq1r32am0Z0h94DeuOb5AilV9NwvVa1u4TZmsyh/WzAlI9h/AIU 5liVeta54QpW+9EtUmai5E8tMQdVJBc+W6Eku94ufUA9Zez1EwcJIgjklm2W7JTiye7/ qL1zVXei9s8pxtzKWTjmF5M4dOUiHKP0955466dEP8K0iTcDHJrokHtvhaVIMhyCC/qj +Neqwv8cviSR+tw99BgQcSTkwY2P74aWwm0LePk+URtMJkbyV73fb4KUpifo44Rr+atc +enw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=LO6lJXnZB9yTs9GW667CMqTkRRPFCiFmAMI7Lk5MZzY=; b=e3WkcwsKNFoT13l7hZai4yyI83Mi6L4LWEinSZSibI+t12+Onb0RUCqiZZK8CsNzM+ +PoI/vZzUV1LjxTkNK0d9fU3KkIAgUmM9kGaTkdFN5M1a3Cz6w1V5liCPt1o2kZ80NuP mfosmp1zOD/l2ZGMLaN3HOzSTJW4/v4pPVLkEwkRNqVn7EJsIIHpmkt3xDF/1oI2myBy PKU3xS9DdNsPLmf+AFMQ5Bi2Zvqo8j4qLkBh3ShLlkNlU5lbcH+s4+GimtI3i6azHLw+ 8/ITPORvVGlir1ahcZzZsMpeA6+XPPheiMurIbo3aMp55Xkl59DtziS59LHDN5wNqbMX NgHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="Pb/LIDXH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si17802510jaq.64.2021.04.06.11.57.52; Tue, 06 Apr 2021 11:58:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="Pb/LIDXH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233859AbhDFKJm (ORCPT + 99 others); Tue, 6 Apr 2021 06:09:42 -0400 Received: from mout.gmx.net ([212.227.15.15]:42401 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233604AbhDFKJm (ORCPT ); Tue, 6 Apr 2021 06:09:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1617703768; bh=8BFgwwQsCdpZB3KEkBauG0JI1pthdfTr1AMrrHOMCU4=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=Pb/LIDXHOkmFGq19jLe5HlMh4Rp+H7shmdi4SwxwRYrv5TonK6vhDB1Uj3EPKCbIY Ik+bI3d5MmYAM8/eQCQ6nOCRx3BqVkCvNN/Q76Hj2XsKubHBnRz2n9OtxBEmIp66UE 12ZBv8o9uiLfNZQQyVHk8/+rlXQb2jl+aVFfVp50= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.20.60] ([92.116.164.142]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MMGN2-1lBdni2wQY-00JLiy; Tue, 06 Apr 2021 12:09:28 +0200 Subject: Re: [PATCH] parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers To: Gao Xiang , linux-parisc@vger.kernel.org Cc: Liam Beguin , linux-kernel@vger.kernel.org, Gao Xiang References: <20210406045929.30331-1-xiang@kernel.org> From: Helge Deller Message-ID: Date: Tue, 6 Apr 2021 12:08:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210406045929.30331-1-xiang@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:IMq8tYVDnfb+yXN9zYAV2GpvJp5AfJb1AhkxL3SLvTL2UXobw24 SpowhBscXc5LnCcamG0aBWy9F8LWm8uD2losKI0lhiPHMevQowWdy9UUrcof0Hn11yUGSU2 QMPCoIwuSWRijTqCtyyd9hGHC3kw2lMLvEYmmBMzQxntoWW1kal0ZxidlpsUXVALPrmmaPO id4xE9WGQVeNfJscJWyZg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:BX+CrpIVLRo=:zjNdnI96rrhSeSK3OIhLvY we5WvufCqUS/e6KD3GTuD1JNDG8s+7DnSDvy7PTyzwcoyVxaGPcFvsl050hXxV3k0hSqT8gGL NAJ3iP/L/+8meSIut3LNiWAEWDN9uWrB4BMen6LSpYfDFyOGOcQxcRxu7sHb42612rpFZmiT5 MpO3HeA8mgTKemzS/CZFFRe9B3/Q6N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-Mailing-List: linux-kernel@vger.kernel.org On 4/6/21 6:59 AM, Gao Xiang wrote: > From: Gao Xiang > > 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@jmo= ndi.org > Cc: Liam Beguin > Cc: Helge Deller > Signed-off-by: Gao Xiang 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, unsig= ned 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; >