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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 12 Nov 2020 14:20:30 +0300
From:   Serge Semin <Sergey.Semin@...kalelectronics.ru>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
CC:     Serge Semin <fancer.lancer@...il.com>,
        kernel test robot <lkp@...el.com>, <kbuild-all@...ts.01.org>,
        <linux-kernel@...r.kernel.org>, <linux-mtd@...ts.infradead.org>
Subject: Re: drivers/mtd/maps/physmap-bt1-rom.c:78:18: sparse: sparse: cast
 removes address space '__iomem' of expression

On Thu, Nov 12, 2020 at 09:27:15AM +0100, Miquel Raynal wrote:
> Hi Sergey,
> 
> Serge Semin <Sergey.Semin@...kalelectronics.ru> 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 <Sergey.Semin@...kalelectronics.ru> 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?

Hm, that's weird. sparse gets happy if a casting to an unsigned type
is used here. That's why the similar statement defined in
bt1_rom_map_read() doesn't cause the sparse warning, while the
statement with ssize_t does.

Can people around explain whether that is just an internal sparse
feature or there is a particular reason of having the unsigned types
casting ignored by sparse in this case? I don't really understand why
removing the __iomem attribute with casting to a signed type cause the
warning, while casting to an unsigned type doesn't...

Anyway I'll send a patch with the fix of using the uintptr_t casting
here. Thanks for suggesting the solution.

-Sergey

> 
> Thanks,
> Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ