projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e9806f8
)
ALSA: memalloc: Catch call with NULL snd_dma_buffer pointer
author
Takashi Iwai
<tiwai@suse.de>
Fri, 5 Nov 2021 10:21:03 +0000
(11:21 +0100)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:08 +0000
(19:17 +0100)
[ Upstream commit
dce9446192439eaac81c21f517325fb473735e53
]
Although we've covered all calls with NULL dma buffer pointer, so far,
there may be still some else in the wild. For catching such a case
more easily, add a WARN_ON_ONCE() in snd_dma_get_ops().
Fixes: 37af81c5998f ("ALSA: core: Abstract memory alloc helpers")
Link:
https://lore.kernel.org/r/20211105102103.28148-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/core/memalloc.c
patch
|
blob
|
history
diff --git
a/sound/core/memalloc.c
b/sound/core/memalloc.c
index 0b8a1c3eae1b47fd839ae8348e2f7d15a02c77e5..2d842982576bb051bb68c1f004328bc83ae4e95d 100644
(file)
--- a/
sound/core/memalloc.c
+++ b/
sound/core/memalloc.c
@@
-494,6
+494,8
@@
static const struct snd_malloc_ops *dma_ops[] = {
static const struct snd_malloc_ops *snd_dma_get_ops(struct snd_dma_buffer *dmab)
{
+ if (WARN_ON_ONCE(!dmab))
+ return NULL;
if (WARN_ON_ONCE(dmab->dev.type <= SNDRV_DMA_TYPE_UNKNOWN ||
dmab->dev.type >= ARRAY_SIZE(dma_ops)))
return NULL;