From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, sbest@us.ibm.com,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
paulus@samba.org, anton@samba.org
Subject: Re: [PATCH 1/1] Punch a hole in /dev/mem for librtas
Date: Mon, 05 Dec 2011 10:18:21 +1100 [thread overview]
Message-ID: <1323040701.11728.27.camel@pasglop> (raw)
In-Reply-To: <144CAEA6-C129-4935-B6D1-A7D6F24530A5@kernel.crashing.org>
On Sat, 2011-12-03 at 04:22 +0100, Segher Boessenkool wrote:
> > +static inline int page_is_rtas_user_buf(unsigned long pfn)
> > +{
> > + unsigned long paddr = (pfn << PAGE_SHIFT);
> > + if (paddr >= rtas_rmo_buf && paddr < (rtas_rmo_buf +
> > RTAS_RMOBUF_MAX))
>
> It probably cannot overflow with actual values of rtas_rmo_buf
> and RTAS_RMOBUF_MAX, but otherwise it is an incorrect test;
> please write
>
> if (paddr >= rtas_rmo_buf && paddr - rtas_rmo_buf < RTAS_RMOBUF_MAX)
>
> (and, _MAX? Shouldn't it be the actual size here? Or is _MAX
> just a confusing name :-) )
The original code is a lot more readable and perfectly correct for all
possible values of rtas_rmo_buf :-)
Cheers,
Ben.
next prev parent reply other threads:[~2011-12-04 23:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 22:26 [PATCH 1/1] Punch a hole in /dev/mem for librtas Sukadev Bhattiprolu
2011-12-03 3:22 ` Segher Boessenkool
2011-12-04 23:18 ` Benjamin Herrenschmidt [this message]
2011-12-05 7:58 ` Segher Boessenkool
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=1323040701.11728.27.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=anton@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=sbest@us.ibm.com \
--cc=segher@kernel.crashing.org \
--cc=sukadev@linux.vnet.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.