linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Chen Gong <gong.chen@linux.intel.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH 1/2 V2] ACPI/APEI: Add parameter check before error injection
Date: Wed, 22 May 2013 12:33:30 +0200	[thread overview]
Message-ID: <20130522103330.GA15085@pd.tnic> (raw)
In-Reply-To: <20130522061029.GA25406@gchen.bj.intel.com>

On Wed, May 22, 2013 at 02:10:29AM -0400, Chen Gong wrote:
> > +	 * When error injection type is memory related, param2 is the address
> > +	 * mask of param1. This mask is used to ensure that the final address
> > +	 * (param1 & param2) is meaningful. If param2 has a *weird* style
> > +	 * like 0xf0f0f0f0f0f0f0f0, it means the injection address can be
> > +	 * anywhere around param1, and that must be forbidden. In that reason,
> > +	 * PAGE_MASK is employed to avoid injection address discontinuous.
> > +	 * If one finds a special case not to satisfy this requirement, please
> > +	 * fix it.
> > +	 */
> > +	pfn = PFN_DOWN(param1 & param2);
> > +	if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK))
> > +		return -EINVAL;
> > 
> > This has too much comment (rare!) and is still too complicated. Split the tests apart?
> 
> Your comment is great to me. Boris ever mentioned that
> "(param2 & PAGE_MASK) != PAGE_MASK)" is not usual, most of situations are
> like "(param2 & PAGE_MASK) != param2). So he wants here I can give a clear
> explanation for it. Maybe I can move my explanation into patch description.

No, please not in the patch description as no one would read it there.
You could move it above the function definition. Also, you could
simplify it a bit.

Thanks.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2013-05-22 10:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20  7:20 Parameter check for EINJ error injection - V2 Chen Gong
2013-05-20  7:20 ` [PATCH 1/2 V2] ACPI/APEI: Add parameter check before error injection Chen Gong
2013-05-21 20:19   ` Luck, Tony
2013-05-22  6:10     ` Chen Gong
2013-05-22 10:33       ` Borislav Petkov [this message]
2013-05-20  7:20 ` [PATCH 2/2 V2] ACPI/APEI: Update einj documentation for param1/param2 Chen Gong

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=20130522103330.GA15085@pd.tnic \
    --to=bp@alien8.de \
    --cc=gong.chen@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=tony.luck@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).