From: Takashi Iwai Date: Mon, 4 Feb 2019 13:34:00 +0000 (+0100) Subject: ALSA: core: Don't allow NULL device for memory allocation X-Git-Tag: v5.1-rc1~148^2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ce1d63ed7210e7120070297976460f868c36314;p=thirdparty%2Fkernel%2Fstable.git ALSA: core: Don't allow NULL device for memory allocation Since we covered all callers with NULL device pointer, let's catch the remaining calls with NULL and warn explicitly. Acked-by: Christoph Hellwig Signed-off-by: Takashi Iwai --- diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 59a4adc286ed7..eb974235c92bd 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -182,6 +182,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, return -ENXIO; if (WARN_ON(!dmab)) return -ENXIO; + if (WARN_ON(!device)) + return -EINVAL; dmab->dev.type = type; dmab->dev.dev = device;