From: Prasad Joshi Date: Fri, 31 Aug 2012 03:25:21 +0000 (+0530) Subject: ASoC: spear: correct the check for NULL dma_buffer pointer X-Git-Tag: upstream/snapshot3+hdmi~6699^2^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd4fb262b31ecb06bf93defb036e72b33ddf0200;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ASoC: spear: correct the check for NULL dma_buffer pointer The if condition if (!buf && !buf->area) checks if the buf pointer is NULL and then dereferences it again to check if the buffer area is NULL, resulting in possible NULL dereference. Signed-off-by: Prasad Joshi Signed-off-by: Mark Brown --- diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 97c2cac..8c7f237 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c @@ -138,7 +138,7 @@ static void spear_pcm_free(struct snd_pcm *pcm) continue; buf = &substream->dma_buffer; - if (!buf && !buf->area) + if (!buf || !buf->area) continue; dma_free_writecombine(pcm->card->dev, buf->bytes,