From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0FE8C2D0A3 for ; Thu, 12 Nov 2020 15:44:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 360DE20A8B for ; Thu, 12 Nov 2020 15:44:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DzYk/una" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 360DE20A8B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bhBE/j1R7JFcQ5X/6rdu+e0SWjnVmcQzNSKhMT6ST/I=; b=DzYk/unaHHytNad4ZRfykGLJV dzVqMbZ6d8sJXPOY7QpB8dVJxHFAX0LIsFTWfyxcSe6rFcnl1dowUVgghRen+WjWxft46bgHzkNg1 AlhqbTppixsi0Y8RLip1zlXSSyIcK/MHxxCBShkfAVmyPXMVgygiQnms9HEvZxa2GKrJg6mDpiqwU AmUPONqv2KAKv3+tCtPVdXQtk4hJwfzvyZJWNyhqmQ7fOalwy96UYt2YjUvZ0zMacoj8NzCiuI1G+ mmt1HGi9ZWEw4ppy3d7nWROz5vmY6COAOI5BvmFDj0iiNEipO32+m2lZMnudumP7Ce6Lk3c+oB+SD g0hpRuNFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdEkm-0006FO-Ai; Thu, 12 Nov 2020 15:43:16 +0000 Received: from relay12.mail.gandi.net ([217.70.178.232]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdEkf-0006Ct-2c for linux-mtd@lists.infradead.org; Thu, 12 Nov 2020 15:43:13 +0000 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 94DAF20001A; Thu, 12 Nov 2020 15:43:02 +0000 (UTC) Date: Thu, 12 Nov 2020 16:43:01 +0100 From: Miquel Raynal To: Serge Semin Subject: Re: drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast removes address space '__iomem' of expression Message-ID: <20201112164301.60032276@xps13> In-Reply-To: <20201112152739.r4673zyeixkcwukx@mobilestation> References: <202011021254.XC70BaQT-lkp@intel.com> <20201110113827.hl5i27cpl6exo3md@mobilestation> <20201110163556.3e3423f6@xps13> <20201111192259.ovdyjcuue7fx2bqa@mobilestation> <20201112092715.7e466405@xps13> <8cdc6166-7183-c8a9-5c27-93a511e6471a@ti.com> <20201112152739.r4673zyeixkcwukx@mobilestation> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_104309_383640_8B9E9BC5 X-CRM114-Status: GOOD ( 18.57 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kbuild-all@lists.01.org, Vignesh Raghavendra , linux-kernel@vger.kernel.org, Serge Semin , linux-mtd@lists.infradead.org, kernel test robot Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org SGkgU2VyZ2UsCgpTZXJnZSBTZW1pbiA8U2VyZ2V5LlNlbWluQGJhaWthbGVsZWN0cm9uaWNzLnJ1 PiB3cm90ZSBvbiBUaHUsIDEyIE5vdgoyMDIwIDE4OjI3OjM5ICswMzAwOgoKPiBIZWxsbyBWaWdu ZXNoCj4gCj4gT24gVGh1LCBOb3YgMTIsIDIwMjAgYXQgMDg6MzA6NDJQTSArMDUzMCwgVmlnbmVz aCBSYWdoYXZlbmRyYSB3cm90ZToKPiA+IAo+ID4gCj4gPiBPbiAxMS8xMi8yMCAxOjU3IFBNLCBN aXF1ZWwgUmF5bmFsIHdyb3RlOiAgCj4gPiA+IEhpIFNlcmdleSwKPiA+ID4gCj4gPiA+IFNlcmdl IFNlbWluIDxTZXJnZXkuU2VtaW5AYmFpa2FsZWxlY3Ryb25pY3MucnU+IHdyb3RlIG9uIFdlZCwg MTEgTm92Cj4gPiA+IDIwMjAgMjI6MjI6NTkgKzAzMDA6Cj4gPiA+ICAgCj4gPiA+PiBPbiBUdWUs IE5vdiAxMCwgMjAyMCBhdCAwNDozNTo1NlBNICswMTAwLCBNaXF1ZWwgUmF5bmFs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kaXNjdXNzaW9uIG1haWxpbmcgbGlzdApodHRwOi8vbGlz dHMuaW5mcmFkZWFkLm9yZy9tYWlsbWFuL2xpc3RpbmZvL2xpbnV4LW10ZC8K From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2618832715192040580==" MIME-Version: 1.0 From: Miquel Raynal To: kbuild-all@lists.01.org Subject: Re: drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast removes address space '__iomem' of expression Date: Thu, 12 Nov 2020 16:43:01 +0100 Message-ID: <20201112164301.60032276@xps13> In-Reply-To: <20201112152739.r4673zyeixkcwukx@mobilestation> List-Id: --===============2618832715192040580== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Serge, Serge Semin wrote on Thu, 12 Nov 2020 18:27:39 +0300: > Hello Vignesh > = > On Thu, Nov 12, 2020 at 08:30:42PM +0530, Vignesh Raghavendra wrote: > > = > > = > > On 11/12/20 1:57 PM, Miquel Raynal wrote: = > > > Hi Sergey, > > > = > > > Serge Semin wrote on Wed, 11 Nov > > > 2020 22:22:59 +0300: > > > = > > >> On Tue, Nov 10, 2020 at 04:35:56PM +0100, Miquel Raynal wrote: = > > >>> Hi Serge, > > >>> > > >>> Serge Semin wrote on Tue, 10 = Nov > > >>> 2020 14:38:27 +0300: > > >>> = > > >>>> Hello Miquel, > > >>>> > > >>>> A situation noted by the warning below won't cause any problem bec= ause > > >>>> the casting is done to a non-dereferenced variable. It is utilized > > >>>> as a pointer bias later in that function. Shall we just ignore the > > >>>> warning or still fix it somehow? = > > >>> = > > >> = > > >>> Do you think the cast to a !__iomem value is mandatory here? = > > >> > > >> It's not mandatory to have the casting with no __iomem, but wouldn't > > >> doing like this: > > >> + shift =3D (ssize_t __iomem)src & 0x3; > > >> be looking weird? Really, is there a good way to somehow extract the= first > > >> two bits of a __iomem pointer without getting the sparse warning? = > > > = > > > I asked around me, what about trying uintptr_t? > > > = > > = > = > > One more way is to use __force to tell sparse that this casting is > > intentional: > > = > > shift =3D (__force ssize_t)src & 0x3; = > = > Oh, great! That solution is actually much better than using some > currently unexplained sparse peculiarity! I was thinking about applying > some other attribute, but __force just didn't come to my mind. Thank > you very much for the suggestion. I'll post the fix with the solution > suggested by you. Is the ssize_t cast the right one btw? I would definitely prefer an unsigned type here. Thanks, Miqu=C3=A8l --===============2618832715192040580==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3763CC2D0A3 for ; Thu, 12 Nov 2020 15:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1CF520A8B for ; Thu, 12 Nov 2020 15:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728745AbgKLPnO convert rfc822-to-8bit (ORCPT ); Thu, 12 Nov 2020 10:43:14 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:40691 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728688AbgKLPnI (ORCPT ); Thu, 12 Nov 2020 10:43:08 -0500 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 94DAF20001A; Thu, 12 Nov 2020 15:43:02 +0000 (UTC) Date: Thu, 12 Nov 2020 16:43:01 +0100 From: Miquel Raynal To: Serge Semin Cc: Vignesh Raghavendra , Serge Semin , , , kernel test robot , Subject: Re: drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast removes address space '__iomem' of expression Message-ID: <20201112164301.60032276@xps13> In-Reply-To: <20201112152739.r4673zyeixkcwukx@mobilestation> References: <202011021254.XC70BaQT-lkp@intel.com> <20201110113827.hl5i27cpl6exo3md@mobilestation> <20201110163556.3e3423f6@xps13> <20201111192259.ovdyjcuue7fx2bqa@mobilestation> <20201112092715.7e466405@xps13> <8cdc6166-7183-c8a9-5c27-93a511e6471a@ti.com> <20201112152739.r4673zyeixkcwukx@mobilestation> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Serge, Serge Semin wrote on Thu, 12 Nov 2020 18:27:39 +0300: > Hello Vignesh > > On Thu, Nov 12, 2020 at 08:30:42PM +0530, Vignesh Raghavendra wrote: > > > > > > On 11/12/20 1:57 PM, Miquel Raynal wrote: > > > Hi Sergey, > > > > > > Serge Semin wrote on Wed, 11 Nov > > > 2020 22:22:59 +0300: > > > > > >> On Tue, Nov 10, 2020 at 04:35:56PM +0100, Miquel Raynal wrote: > > >>> Hi Serge, > > >>> > > >>> Serge Semin wrote on Tue, 10 Nov > > >>> 2020 14:38:27 +0300: > > >>> > > >>>> Hello Miquel, > > >>>> > > >>>> A situation noted by the warning below won't cause any problem because > > >>>> the casting is done to a non-dereferenced variable. It is utilized > > >>>> as a pointer bias later in that function. Shall we just ignore the > > >>>> warning or still fix it somehow? > > >>> > > >> > > >>> Do you think the cast to a !__iomem value is mandatory here? > > >> > > >> It's not mandatory to have the casting with no __iomem, but wouldn't > > >> doing like this: > > >> + shift = (ssize_t __iomem)src & 0x3; > > >> be looking weird? Really, is there a good way to somehow extract the first > > >> two bits of a __iomem pointer without getting the sparse warning? > > > > > > I asked around me, what about trying uintptr_t? > > > > > > > > One more way is to use __force to tell sparse that this casting is > > intentional: > > > > shift = (__force ssize_t)src & 0x3; > > Oh, great! That solution is actually much better than using some > currently unexplained sparse peculiarity! I was thinking about applying > some other attribute, but __force just didn't come to my mind. Thank > you very much for the suggestion. I'll post the fix with the solution > suggested by you. Is the ssize_t cast the right one btw? I would definitely prefer an unsigned type here. Thanks, Miquèl