summaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c24xx
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-21 16:11:09 +0100
committerKukjin Kim <kgene.kim@samsung.com>2012-11-21 16:11:09 +0100
commit70b9b24d4d240ff5f6087bca4013c6969af275ab (patch)
treebf856fa979bdbed8b26bd2db04ad562b19b9d531 /arch/arm/plat-s3c24xx
parentLinux 3.7-rc6 (diff)
downloadlinux-70b9b24d4d240ff5f6087bca4013c6969af275ab.tar.xz
linux-70b9b24d4d240ff5f6087bca4013c6969af275ab.zip
ARM: S3C24XX: Fix potential NULL pointer dereference error
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>
Diffstat (limited to 'arch/arm/plat-s3c24xx')
-rw-r--r--arch/arm/plat-s3c24xx/dma.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index db98e7021f0d..0abd1c469887 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 */