From: Takashi Iwai Date: Wed, 8 Oct 2014 10:08:38 +0000 (+0200) Subject: ALSA: Allow pass NULL dev for snd_pci_quirk_lookup() X-Git-Tag: v4.9.8~5095^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5b50ada76f44c8742a123813689bff4db062a5a;p=platform%2Fkernel%2Flinux-rpi3.git ALSA: Allow pass NULL dev for snd_pci_quirk_lookup() Add a NULL check in snd_pci_quirk_lookup() so that NULL can be passed as a pci_dev pointer. This fixes the possible NULL dereferences in HD-audio drivers. Reported-by: Dan Carpenter Signed-off-by: Takashi Iwai --- diff --git a/sound/core/misc.c b/sound/core/misc.c index 30e027e..f2e8226 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -145,6 +145,8 @@ EXPORT_SYMBOL(snd_pci_quirk_lookup_id); const struct snd_pci_quirk * snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) { + if (!pci) + return NULL; return snd_pci_quirk_lookup_id(pci->subsystem_vendor, pci->subsystem_device, list);