Skip to contentSkip to conversation

ASoC: correct the check for NULL dma_buffer pointer

PATCH Applied Prasad Joshi 2 participants 2 messages Aug 31, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: 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.

---
 sound/soc/spear/spear_pcm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/spear/spear_pcm.c +1 -1
index 97c2cac..8c7f237 100644
@@ -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,
Signature · 1 line
1.7.5.4
Applied
#1 lore raw
Quoted 6 lines · Prasad Joshi

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.

Applied, thanks.