Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4529pxf; Tue, 6 Apr 2021 13:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAdewrAABOVaal15C5jPMQp0s1TUiIs9OuOodD3KZbWajdc1ARTg6Cs0N7PNbibaAiIOUO X-Received: by 2002:a17:906:168c:: with SMTP id s12mr8061583ejd.462.1617740183129; Tue, 06 Apr 2021 13:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617740183; cv=none; d=google.com; s=arc-20160816; b=YKtIzjYTv1jjfOF65L6q9zoAN49sx/8cwyEObn9mKtvCA23y556v6BpZxDwAhx6ZCV bo7k/GXrSl0mSLjpMeEYo05yS+1wi0L76fVPupYXUikHP6qZotQpqU1DBHpZUotD9+xd Bdd26Gx5Ge5UVApgoiJ12kYDQ5YkOeyiKsGhTTejZ0LdST+rrHzlS7eP2g1uxK6SC5pX ynXu1OE9L0jBvnEbP0+KCotbmhaxgXq18+uAgQVN/2dgrhpoLzXqdgB7g4vOmsxDoEUr dB3Y4ZgxD8/agEemyrJ7l62DqRmUuQmbJoom9tgYvUEwOLFRO1vGI9p21XRwUl5Uk1G3 Vr7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=aoo4T5OcYVMmIH5rVBArOHDK8SbcOJSOJ1qUYgR/5T8=; b=Xn9n31AJ75DrXLqRrZjEPvE2i37za/0ZvQgFaHEwPeGx8qjaHLv07manAQrITxFELG 2gKwoTvarZ420f1XLZAeyQFbvNn4NaIDZt4LSQtKaWRmGcW+78DILfWYYTsEFu5oIPGC tJ51mcOs6KYmJ+UlxXYZc+EXE+aqqOvUjzH284HUkH651CeiMjuyWNS2QNkl8OFVjMwp ImgIkjiJwbEeylYk6m6Sk/T5pjO7MP7xIiHlN2mGqwWWtyl/zpTxEK2fXA8rd6KYSe95 fVpgtv0ElBe5cqiRFqZztzLKNJ97DkQTTmkysnBJZ4zb/evvWONkFZDImer8K8ey+C/p Od8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AvnKlSPr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si16896467ejd.683.2021.04.06.13.15.59; Tue, 06 Apr 2021 13:16:23 -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=@redhat.com header.s=mimecast20190719 header.b=AvnKlSPr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245237AbhDFK6S (ORCPT + 99 others); Tue, 6 Apr 2021 06:58:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26500 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245259AbhDFK6P (ORCPT ); Tue, 6 Apr 2021 06:58:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617706687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aoo4T5OcYVMmIH5rVBArOHDK8SbcOJSOJ1qUYgR/5T8=; b=AvnKlSPrT2rbxeIr7hzHPgE1FIFEaIEmuwVwtjzpFDSS7c89SEXHhCcM585T6XgLiWkA93 MmgNkWfTtvkJispz9eMSEDyNIh47YNDIPqCTeTWfYl3YP0hIGUH8S7xlwgn6Dbn5T+ykvh 0oqFpWqa9s2D1y17v8/Tv0wqSwWiJnQ= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343-Sl4z2ceSMLai-INDRV5ebA-1; Tue, 06 Apr 2021 06:58:05 -0400 X-MC-Unique: Sl4z2ceSMLai-INDRV5ebA-1 Received: by mail-pl1-f198.google.com with SMTP id m4so797308plx.12 for ; Tue, 06 Apr 2021 03:58:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aoo4T5OcYVMmIH5rVBArOHDK8SbcOJSOJ1qUYgR/5T8=; b=qJFzsbKp0nrgiye4SXn2TK3vnKFbLigOKzAu3MnP8eXJky+bEG/EpUlJH2e846Roe1 Vkh3n8672AhQHgKdCnoVB8Zfy/N4gmqFZxbGaMJAp2jUB4rO2dWSj/nSBOu1+hdJdplK SnHIzl6G2h+aXpHEP1APHFo+WvBnO1PMRdDdjFgtH8CZ9i/IWT6Rn2GHU0y9yma+dyFd XuO7PKlcfg4SCNffa+XS8xOkGr0AYACz+QNnn3gZZR5Plsx5fLqPosX/SBN5G1W6m9oi fEh8W05b2nbhwIcY5MITNMbHb28KrVF8E3ocAGGRUFJGPY3EZcjY52g91N0EJailV+VG 5ppw== X-Gm-Message-State: AOAM530HTQ3Mb7G9kqeY2TG7Opb3/QbZK73WQ6MCsYBvlkiSLhbxTnhi qxjw1VxiWQEd9SgYrKmFgEnNl0A/TMliuEbdWO58Ef3j3VOgOqv08TIA7rF4ASpifojfKQelmpu 7uvX1CDr2b+YBcpEC7MiowUOB X-Received: by 2002:a65:6643:: with SMTP id z3mr1474566pgv.387.1617706684311; Tue, 06 Apr 2021 03:58:04 -0700 (PDT) X-Received: by 2002:a65:6643:: with SMTP id z3mr1474553pgv.387.1617706684057; Tue, 06 Apr 2021 03:58:04 -0700 (PDT) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id c6sm19868861pfj.99.2021.04.06.03.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 03:58:03 -0700 (PDT) Date: Tue, 6 Apr 2021 18:57:53 +0800 From: Gao Xiang To: Helge Deller Cc: Gao Xiang , linux-parisc@vger.kernel.org, Liam Beguin , linux-kernel@vger.kernel.org Subject: Re: [PATCH] parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers Message-ID: <20210406105753.GA550515@xiangao.remote.csb> References: <20210406045929.30331-1-xiang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 06, 2021 at 12:08:55PM +0200, Helge Deller wrote: > 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@jmondi.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 all! :) Thanks, Gao Xiang > > 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; > > >