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]
Date:	Wed, 30 Jan 2013 12:21:21 +0100 (CET)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Russell King - ARM Linux <linux@....linux.org.uk>
cc:	walter harms <wharms@....de>, Joe Perches <joe@...ches.com>,
	Mike Rapoport <mike@...pulab.co.il>, Valdis.Kletnieks@...edu,
	cocci@...teme.lip6.fr, Dan Carpenter <dan.carpenter@...cle.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.cz>,
	Paul Fulghum <paulkf@...rogate.com>,
	David Howells <dhowells@...hat.com>,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: coccinelle and bitmask arithmetic



On Wed, 30 Jan 2013, Russell King - ARM Linux wrote:

> On Wed, Jan 30, 2013 at 09:21:28AM +0100, walter harms wrote:
> > Great hit Joe :)
> >
> > Sometimes i am really surprised what code can be found
> > in the kernal and it is still working.
> > Having no clue of the code i suspect somebody tries to
> > check is mask outside the range it should read
> > PHYS_OFFSET |( SZ_64M - 1)
> > maybe someone should tell them that
> > 1+1=10 while 1|1=1
> > It does not seem to matter here (or ... ?)
>
> This PCI host is only used on one platform (ARMCORE).
>
> For this, PHYS_OFFSET will be a value with only the top few bits of a
> 32-bit word set (such as 0xc0000000) - it's certainly not going to have
> any bits set below bit 26 on the platform this driver gets used on.
> "SZ_64M - 1" is the size of the window that RAM appears.
>
> So, _either_ logical OR or addition works.
>
> If we _did_ end up with a PHYS_OFFSET with bits less than bit 26 set
> here, we'd have bigger problems - because the base of RAM in PCI space
> will not correspond with PHYS_OFFSET and all the DMA mapping stuff breaks.

The "problem" is that the computation is done inconsistently within the
same file.  Sometimes with + and sometimes with |.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ