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.4-rc1~1151^2~91 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ce1d63ed7210e7120070297976460f868c36314;p=platform%2Fkernel%2Flinux-rpi.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 59a4adc..eb97423 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;