From: Andrew Morton <akpm@linux-foundation.org>
To: mgross@linux.intel.com
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org
Subject: Re: [PATCH]intel-iommu-PMEN support
Date: Mon, 19 Nov 2007 16:38:02 -0800 [thread overview]
Message-ID: <20071119163802.92cf1ac8.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071116223957.GA26796@linux.intel.com>
On Fri, 16 Nov 2007 14:39:57 -0800
mark gross <mgross@linux.intel.com> wrote:
> -#define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) - 1
> +#define MAX_FAULT_REASON_IDX (ARRAY_SIZE(fault_reason_strings) - 1)
hm. The logic in there looks screwy.
static char *fault_reason_strings[] =
{
"Software",
"Present bit in root entry is clear",
"Present bit in context entry is clear",
"Invalid context entry",
"Access beyond MGAW",
"PTE Write access is not set",
"PTE Read access is not set",
"Next page table ptr is invalid",
"Root table address invalid",
"Context table ptr is invalid",
"non-zero reserved fields in RTP",
"non-zero reserved fields in CTP",
"non-zero reserved fields in PTE",
"Unknown"
};
#define MAX_FAULT_REASON_IDX (ARRAY_SIZE(fault_reason_strings) - 1)
char *dmar_get_fault_reason(u8 fault_reason)
{
if (fault_reason >= MAX_FAULT_REASON_IDX)
return fault_reason_strings[MAX_FAULT_REASON_IDX - 1];
else
return fault_reason_strings[fault_reason];
}
so all invalid fault_reasons will cause us to display "non-zero reserved
fields in PTE".
Why not just do
if (fault_reason >= ARRAY_SIZE(fault_reason_strings))
return "Unknown";
return fault_reason_strings[fault_reason];
?
(might as well make fault_reason_strings[] const, too).
next prev parent reply other threads:[~2007-11-20 0:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 22:39 [PATCH]intel-iommu-PMEN support mark gross
2007-11-17 8:52 ` Muli Ben-Yehuda
2007-11-20 0:38 ` Andrew Morton [this message]
2007-11-20 17:59 ` mark gross
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=20071119163802.92cf1ac8.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=torvalds@linux-foundation.org \
/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