Skip to content

Commit

Permalink
ARM: S3C24XX: Fix potential NULL pointer dereference error
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
  • Loading branch information
Sachin Kamat authored and Kukjin Kim committed Nov 21, 2012
1 parent f4a75d2 commit 70b9b24
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arch/arm/plat-s3c24xx/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 70b9b24

Please sign in to comment.