ALSA: core: Don't allow NULL device for memory allocation
authorTakashi Iwai <tiwai@suse.de>
Mon, 4 Feb 2019 13:34:00 +0000 (14:34 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 5 Feb 2019 10:05:26 +0000 (11:05 +0100)
Since we covered all callers with NULL device pointer, let's catch the
remaining calls with NULL and warn explicitly.

Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/memalloc.c

index 59a4adc286ed77bb647788706a6ebd9323a1b640..eb974235c92bdfba19d706735a88a9cf95897664 100644 (file)
@@ -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;