All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] freescale: beyond ARRAY_SIZE of fdev->chan
@ 2009-05-19 23:17 Roel Kluin
  2009-05-22  8:03   ` Li Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-05-19 23:17 UTC (permalink / raw)
  To: leoli; +Cc: linuxppc-embedded, lkml, Andrew Morton

Do not go beyond ARRAY_SIZE of fdev->chan

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index da8a8ed..391b1bd 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -830,7 +830,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev,
 			new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);
 
 	new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7;
-	if (new_fsl_chan->id > FSL_DMA_MAX_CHANS_PER_DEVICE) {
+	if (new_fsl_chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) {
 		dev_err(fdev->dev, "There is no %d channel!\n",
 				new_fsl_chan->id);
 		err = -EINVAL;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] freescale: beyond ARRAY_SIZE of fdev->chan
  2009-05-19 23:17 [PATCH] freescale: beyond ARRAY_SIZE of fdev->chan Roel Kluin
@ 2009-05-22  8:03   ` Li Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Li Yang @ 2009-05-22  8:03 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linuxppc-dev, Andrew Morton, lkml

On Wed, May 20, 2009 at 7:17 AM, Roel Kluin <roel.kluin@gmail.com> wrote:
> Do not go beyond ARRAY_SIZE of fdev->chan
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Indeed, thanks.

But I would like the title and description of this patch be changed to
like this:

fsldma: fix check on potential fdev->chan[] overflow

Fix the check of potential array overflow when using corrupted channel
device tree nodes.

> ---
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index da8a8ed..391b1bd 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -830,7 +830,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dm=
a_device *fdev,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0new_fsl_chan->id =3D ((new_fsl_chan->reg.start=
 - 0x100) & 0xfff) >> 7;
> - =C2=A0 =C2=A0 =C2=A0 if (new_fsl_chan->id > FSL_DMA_MAX_CHANS_PER_DEVIC=
E) {
> + =C2=A0 =C2=A0 =C2=A0 if (new_fsl_chan->id >=3D FSL_DMA_MAX_CHANS_PER_DE=
VICE) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_err(fdev->dev,=
 "There is no %d channel!\n",
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0new_fsl_chan->id);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D -EINVAL;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] freescale: beyond ARRAY_SIZE of fdev->chan
@ 2009-05-22  8:03   ` Li Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Li Yang @ 2009-05-22  8:03 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linuxppc-dev, lkml, Andrew Morton

On Wed, May 20, 2009 at 7:17 AM, Roel Kluin <roel.kluin@gmail.com> wrote:
> Do not go beyond ARRAY_SIZE of fdev->chan
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Indeed, thanks.

But I would like the title and description of this patch be changed to
like this:

fsldma: fix check on potential fdev->chan[] overflow

Fix the check of potential array overflow when using corrupted channel
device tree nodes.

> ---
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index da8a8ed..391b1bd 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -830,7 +830,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev,
>                        new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);
>
>        new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7;
> -       if (new_fsl_chan->id > FSL_DMA_MAX_CHANS_PER_DEVICE) {
> +       if (new_fsl_chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) {
>                dev_err(fdev->dev, "There is no %d channel!\n",
>                                new_fsl_chan->id);
>                err = -EINVAL;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-22  8:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 23:17 [PATCH] freescale: beyond ARRAY_SIZE of fdev->chan Roel Kluin
2009-05-22  8:03 ` Li Yang
2009-05-22  8:03   ` Li Yang

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.