linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: correct the check for NULL dma_buffer pointer
@ 2012-08-31  3:25 Prasad Joshi
  2012-08-31 21:24 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Prasad Joshi @ 2012-08-31  3:25 UTC (permalink / raw)
  To: prasadjoshi.linux
  Cc: lrg, broonie, perex, tiwai, rajeev-dlh.kumar, alsa-devel, linux-kernel

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 <prasadjoshi.linux@gmail.com>
---
 sound/soc/spear/spear_pcm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: correct the check for NULL dma_buffer pointer
  2012-08-31  3:25 [PATCH] ASoC: correct the check for NULL dma_buffer pointer Prasad Joshi
@ 2012-08-31 21:24 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-08-31 21:24 UTC (permalink / raw)
  To: Prasad Joshi
  Cc: lrg, perex, tiwai, rajeev-dlh.kumar, alsa-devel, linux-kernel

On Fri, Aug 31, 2012 at 08:55:21AM +0530, Prasad Joshi wrote:
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-31 21:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31  3:25 [PATCH] ASoC: correct the check for NULL dma_buffer pointer Prasad Joshi
2012-08-31 21:24 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).