diff mbox series

[1/2] ALSA: gus: Fix erroneous memory allocation

Message ID 20211213132444.22385-1-tiwai@suse.de (mailing list archive)
State New, archived
Headers show
Series [1/2] ALSA: gus: Fix erroneous memory allocation | expand

Commit Message

Takashi Iwai Dec. 13, 2021, 1:24 p.m. UTC
snd_gf1_mem_xalloc() returns NULL incorrectly when the memory chunk is
allocated in the middle of the chain.  This patch corrects the return
value to treat it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/isa/gus/gus_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jaroslav Kysela Dec. 13, 2021, 1:57 p.m. UTC | #1
On 13. 12. 21 14:24, Takashi Iwai wrote:
> snd_gf1_mem_xalloc() returns NULL incorrectly when the memory chunk is
> allocated in the middle of the chain.  This patch corrects the return
> value to treat it properly.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Reviewed-by: Jaroslav Kysela <perex@perex.cz>

			Thanks,
				Jaroslav
diff mbox series

Patch

diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 4c691dbf2721..5e3ff3137dd7 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -44,7 +44,7 @@  static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
 			else
 				nblock->prev->next = nblock;
 			mutex_unlock(&alloc->memory_mutex);
-			return NULL;
+			return nblock;
 		}
 		pblock = pblock->next;
 	}