public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: cocci@systeme.lip6.fr
Subject: Re: coccinelle and bitmask arithmetic
Date: Wed, 30 Jan 2013 11:14:20 +0000	[thread overview]
Message-ID: <20130130111420.GG23505@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <5108D808.6010405@bfs.de>

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\x10 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.

  parent reply	other threads:[~2013-01-30 11:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 19:40 [patch] TTY: synclink, small cleanup in dtr_rts() Dan Carpenter
2013-01-27 20:04 ` Joe Perches
2013-01-27 20:16   ` Jiri Slaby
2013-01-27 20:19   ` Dan Carpenter
2013-01-27 21:00     ` Joe Perches
     [not found]       ` <C8AFB2C4-4974-4265-A41C-A56C71784F39@microgate.com>
2013-01-28  2:21         ` [PATCH] TTY: synclink: Convert + to | for bit operations Joe Perches
2013-01-28 12:06       ` [patch] TTY: synclink, small cleanup in dtr_rts() walter harms
2013-01-29 15:55     ` Valdis.Kletnieks
2013-01-29 16:13       ` coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts()) Joe Perches
2013-01-29 16:19         ` Julia Lawall
2013-01-29 16:31           ` Joe Perches
     [not found]           ` <20130129173004.GP16282@mwanda>
2013-01-29 17:42             ` Dan Carpenter
2013-01-29 17:49         ` Julia Lawall
2013-01-29 18:03           ` Joe Perches
2013-01-30  8:21             ` coccinelle and bitmask arithmetic walter harms
2013-01-30  8:29               ` Joe Perches
2013-01-30 11:14               ` Russell King - ARM Linux [this message]
2013-01-30 11:21                 ` Julia Lawall
2013-01-30 11:35                   ` Russell King - ARM Linux
2013-01-30 16:53                     ` Joe Perches
2013-01-30 18:23                       ` Russell King - ARM Linux
2013-01-29 18:38         ` coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts()) Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130130111420.GG23505@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox