RE: [PATCH 1/1] ARM: S3C24XX: Fix potential NULL pointer dereference error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sachin Kamat wrote:

> > On 8 November 2012 14:31, Sachin Kamat <sachin.kamat@xxxxxxxxxx> wrote:
> >> chan->end is tested for being NULL. However in the event that it is
> NULL, the
> >> subsequent assignment statement would lead to NULL pointer dereference.
> >> Thus dereferencing it only when it is not NULL.
> >>

Logically, looks OK to me, I'm not sure this patch is right because if
(chan->end) is NULL, we do nothing for chan though...

I think, we need to sort out the dma_enqueue() later.

Will apply, thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@xxxxxxxxxxx>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.


> >> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
> >> ---
> >> Based on Kukjin Kim's for-next branch. Compile tested.
> >> ---
> >>  arch/arm/plat-s3c24xx/dma.c |    9 +++++----
> >>  1 files changed, 5 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
> >> index db98e70..0abd1c4 100644
> >> --- a/arch/arm/plat-s3c24xx/dma.c
> >> +++ b/arch/arm/plat-s3c24xx/dma.c
> >> @@ -473,12 +473,13 @@ int s3c2410_dma_enqueue(enum dma_ch channel, void
> *id,
> >>                 pr_debug("dma%d: %s: buffer %p queued onto non-empty
> channel\n",
> >>                          chan->number, __func__, buf);
> >>
> >> -               if (chan->end == NULL)
> >> +               if (chan->end == NULL) {
> >>                         pr_debug("dma%d: %s: %p not empty, and chan-
> >end==NULL?\n",
> >>                                  chan->number, __func__, chan);
> >> -
> >> -               chan->end->next = buf;
> >> -               chan->end = buf;
> >> +               } else {
> >> +                       chan->end->next = buf;
> >> +                       chan->end = buf;
> >> +               }
> >>         }
> >>
> >>         /* if necessary, update the next buffer field */
> >> --
> >> 1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux