All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: allocation may fail in snd_pcm_oss_change_params()
@ 2009-08-31 14:23 Roel Kluin
  2009-08-31 14:39 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-08-31 14:23 UTC (permalink / raw)
  To: Jaroslav Kysela, alsa-devel, Andrew Morton

Allocation may fail, show if it did.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index dbe406b..ea91a0a 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1047,6 +1047,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
 	runtime->oss.prepare = 1;
 	vfree(runtime->oss.buffer);
 	runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
+	if (runtime->oss.buffer == NULL) {
+		err = -ENOMEM;
+		goto failure;
+	}
 	runtime->oss.buffer_used = 0;
 	if (runtime->dma_area)
 		snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));

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

* Re: [PATCH] ALSA: allocation may fail in snd_pcm_oss_change_params()
  2009-08-31 14:23 [PATCH] ALSA: allocation may fail in snd_pcm_oss_change_params() Roel Kluin
@ 2009-08-31 14:39 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2009-08-31 14:39 UTC (permalink / raw)
  To: Roel Kluin; +Cc: alsa-devel, Andrew Morton

At Mon, 31 Aug 2009 16:23:53 +0200,
Roel Kluin wrote:
> 
> Allocation may fail, show if it did.

Thanks for the patch.
But this isn't enough and still may lead to an error in the rest because
it clears the flag runtime->oss.params before the error path.

I applied with that fix now.


Takashi

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
> index dbe406b..ea91a0a 100644
> --- a/sound/core/oss/pcm_oss.c
> +++ b/sound/core/oss/pcm_oss.c
> @@ -1047,6 +1047,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
>  	runtime->oss.prepare = 1;
>  	vfree(runtime->oss.buffer);
>  	runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
> +	if (runtime->oss.buffer == NULL) {
> +		err = -ENOMEM;
> +		goto failure;
> +	}
>  	runtime->oss.buffer_used = 0;
>  	if (runtime->dma_area)
>  		snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

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

end of thread, other threads:[~2009-08-31 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31 14:23 [PATCH] ALSA: allocation may fail in snd_pcm_oss_change_params() Roel Kluin
2009-08-31 14:39 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.