* [patch] iommu: off by one in dmar_get_fault_reason()
@ 2012-05-12 10:59 ` Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2012-05-12 10:59 UTC (permalink / raw)
To: Suresh Siddha
Cc: Ingo Molnar, Joerg Roedel, Thomas Gleixner, Youquan Song,
linux-kernel, kernel-janitors
fault_reason = ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
past the end of the array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5ef65cf..9390f3f 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[]
const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
{
- if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
+ if (fault_reason >= 0x20 && (fault_reason < 0x20 +
ARRAY_SIZE(irq_remap_fault_reasons))) {
*fault_type = INTR_REMAP;
return irq_remap_fault_reasons[fault_reason - 0x20];
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [patch] iommu: off by one in dmar_get_fault_reason()
@ 2012-05-12 10:59 ` Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2012-05-12 10:59 UTC (permalink / raw)
To: Suresh Siddha
Cc: Ingo Molnar, Joerg Roedel, Thomas Gleixner, Youquan Song,
linux-kernel, kernel-janitors
fault_reason == ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
past the end of the array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5ef65cf..9390f3f 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[] =
const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
{
- if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
+ if (fault_reason >= 0x20 && (fault_reason < 0x20 +
ARRAY_SIZE(irq_remap_fault_reasons))) {
*fault_type = INTR_REMAP;
return irq_remap_fault_reasons[fault_reason - 0x20];
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [patch] iommu: off by one in dmar_get_fault_reason()
2012-05-12 10:59 ` Dan Carpenter
@ 2012-05-12 12:36 ` walter harms
-1 siblings, 0 replies; 9+ messages in thread
From: walter harms @ 2012-05-12 12:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Suresh Siddha, Ingo Molnar, Joerg Roedel, Thomas Gleixner,
Youquan Song, linux-kernel, kernel-janitors
Am 12.05.2012 12:59, schrieb Dan Carpenter:
> fault_reason = ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
> past the end of the array.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 5ef65cf..9390f3f 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[] >
> const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
> {
> - if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
> + if (fault_reason >= 0x20 && (fault_reason < 0x20 +
> ARRAY_SIZE(irq_remap_fault_reasons))) {
> *fault_type = INTR_REMAP;
> return irq_remap_fault_reasons[fault_reason - 0x20];
perhaps this is more readable:
if (fault_reason >= 0x20 && (fault_reason - 0x20 < ARRAY_SIZE(irq_remap_fault_reasons)))
re,
wh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] iommu: off by one in dmar_get_fault_reason()
@ 2012-05-12 12:36 ` walter harms
0 siblings, 0 replies; 9+ messages in thread
From: walter harms @ 2012-05-12 12:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: Suresh Siddha, Ingo Molnar, Joerg Roedel, Thomas Gleixner,
Youquan Song, linux-kernel, kernel-janitors
Am 12.05.2012 12:59, schrieb Dan Carpenter:
> fault_reason == ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
> past the end of the array.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 5ef65cf..9390f3f 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[] =
>
> const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
> {
> - if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
> + if (fault_reason >= 0x20 && (fault_reason < 0x20 +
> ARRAY_SIZE(irq_remap_fault_reasons))) {
> *fault_type = INTR_REMAP;
> return irq_remap_fault_reasons[fault_reason - 0x20];
perhaps this is more readable:
if (fault_reason >= 0x20 && (fault_reason - 0x20 < ARRAY_SIZE(irq_remap_fault_reasons)))
re,
wh
^ permalink raw reply [flat|nested] 9+ messages in thread
* [patch v2] iommu: off by one in dmar_get_fault_reason()
2012-05-12 12:36 ` walter harms
@ 2012-05-13 17:09 ` Dan Carpenter
-1 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2012-05-13 17:09 UTC (permalink / raw)
To: Suresh Siddha
Cc: Ingo Molnar, Joerg Roedel, Thomas Gleixner, Youquan Song,
linux-kernel, kernel-janitors, walter harms
fault_reason - 0x20 = ARRAY_SIZE(irq_remap_fault_reasons) is one past
the end of the array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: re-arranged slightly for readability
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5ef65cf..3a74e44 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1057,8 +1057,8 @@ static const char *irq_remap_fault_reasons[]
const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
{
- if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
- ARRAY_SIZE(irq_remap_fault_reasons))) {
+ if (fault_reason >= 0x20 && (fault_reason - 0x20 <
+ ARRAY_SIZE(irq_remap_fault_reasons))) {
*fault_type = INTR_REMAP;
return irq_remap_fault_reasons[fault_reason - 0x20];
} else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [patch v2] iommu: off by one in dmar_get_fault_reason()
@ 2012-05-13 17:09 ` Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2012-05-13 17:09 UTC (permalink / raw)
To: Suresh Siddha
Cc: Ingo Molnar, Joerg Roedel, Thomas Gleixner, Youquan Song,
linux-kernel, kernel-janitors, walter harms
fault_reason - 0x20 == ARRAY_SIZE(irq_remap_fault_reasons) is one past
the end of the array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: re-arranged slightly for readability
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5ef65cf..3a74e44 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1057,8 +1057,8 @@ static const char *irq_remap_fault_reasons[] =
const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
{
- if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
- ARRAY_SIZE(irq_remap_fault_reasons))) {
+ if (fault_reason >= 0x20 && (fault_reason - 0x20 <
+ ARRAY_SIZE(irq_remap_fault_reasons))) {
*fault_type = INTR_REMAP;
return irq_remap_fault_reasons[fault_reason - 0x20];
} else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [patch] iommu: off by one in dmar_get_fault_reason()
2012-05-12 12:36 ` walter harms
@ 2012-05-13 17:12 ` Dan Carpenter
-1 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2012-05-13 17:12 UTC (permalink / raw)
To: walter harms
Cc: Suresh Siddha, Ingo Molnar, Joerg Roedel, Thomas Gleixner,
Youquan Song, linux-kernel, kernel-janitors
On Sat, May 12, 2012 at 02:36:42PM +0200, walter harms wrote:
>
>
> Am 12.05.2012 12:59, schrieb Dan Carpenter:
> > fault_reason = ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
> > past the end of the array.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> > index 5ef65cf..9390f3f 100644
> > --- a/drivers/iommu/dmar.c
> > +++ b/drivers/iommu/dmar.c
> > @@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[] > >
> > const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
> > {
> > - if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
> > + if (fault_reason >= 0x20 && (fault_reason < 0x20 +
> > ARRAY_SIZE(irq_remap_fault_reasons))) {
> > *fault_type = INTR_REMAP;
> > return irq_remap_fault_reasons[fault_reason - 0x20];
>
> perhaps this is more readable:
> if (fault_reason >= 0x20 && (fault_reason - 0x20 < ARRAY_SIZE(irq_remap_fault_reasons)))
>
Yeah. Probably you're way is nicer.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] iommu: off by one in dmar_get_fault_reason()
@ 2012-05-13 17:12 ` Dan Carpenter
0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2012-05-13 17:12 UTC (permalink / raw)
To: walter harms
Cc: Suresh Siddha, Ingo Molnar, Joerg Roedel, Thomas Gleixner,
Youquan Song, linux-kernel, kernel-janitors
On Sat, May 12, 2012 at 02:36:42PM +0200, walter harms wrote:
>
>
> Am 12.05.2012 12:59, schrieb Dan Carpenter:
> > fault_reason == ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
> > past the end of the array.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> > index 5ef65cf..9390f3f 100644
> > --- a/drivers/iommu/dmar.c
> > +++ b/drivers/iommu/dmar.c
> > @@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[] =
> >
> > const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
> > {
> > - if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
> > + if (fault_reason >= 0x20 && (fault_reason < 0x20 +
> > ARRAY_SIZE(irq_remap_fault_reasons))) {
> > *fault_type = INTR_REMAP;
> > return irq_remap_fault_reasons[fault_reason - 0x20];
>
> perhaps this is more readable:
> if (fault_reason >= 0x20 && (fault_reason - 0x20 < ARRAY_SIZE(irq_remap_fault_reasons)))
>
Yeah. Probably you're way is nicer.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip:core/iommu] iommu: Fix off by one in dmar_get_fault_reason()
2012-05-13 17:09 ` Dan Carpenter
(?)
@ 2012-05-14 13:42 ` tip-bot for Dan Carpenter
-1 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Dan Carpenter @ 2012-05-14 13:42 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, joerg.roedel, youquan.song, stable,
suresh.b.siddha, tglx, wharms, dan.carpenter
Commit-ID: fefe1ed1398b81e3fadc92d11d91162d343c8836
Gitweb: http://git.kernel.org/tip/fefe1ed1398b81e3fadc92d11d91162d343c8836
Author: Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Sun, 13 May 2012 20:09:38 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2012 14:37:47 +0200
iommu: Fix off by one in dmar_get_fault_reason()
fault_reason - 0x20 == ARRAY_SIZE(irq_remap_fault_reasons) is
one past the end of the array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Youquan Song <youquan.song@intel.com>
Cc: walter harms <wharms@bfs.de>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/20120513170938.GA4280@elgon.mountain
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/iommu/dmar.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5ef65cf..3a74e44 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1057,8 +1057,8 @@ static const char *irq_remap_fault_reasons[] =
const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
{
- if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
- ARRAY_SIZE(irq_remap_fault_reasons))) {
+ if (fault_reason >= 0x20 && (fault_reason - 0x20 <
+ ARRAY_SIZE(irq_remap_fault_reasons))) {
*fault_type = INTR_REMAP;
return irq_remap_fault_reasons[fault_reason - 0x20];
} else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-05-14 13:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-12 10:59 [patch] iommu: off by one in dmar_get_fault_reason() Dan Carpenter
2012-05-12 10:59 ` Dan Carpenter
2012-05-12 12:36 ` walter harms
2012-05-12 12:36 ` walter harms
2012-05-13 17:09 ` [patch v2] " Dan Carpenter
2012-05-13 17:09 ` Dan Carpenter
2012-05-14 13:42 ` [tip:core/iommu] iommu: Fix " tip-bot for Dan Carpenter
2012-05-13 17:12 ` [patch] iommu: " Dan Carpenter
2012-05-13 17:12 ` Dan Carpenter
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.