]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: cs4236: fix an incorrect NULL check on list iterator
authorXiaomeng Tong <xiam0nd.tong@gmail.com>
Sun, 27 Mar 2022 06:08:22 +0000 (14:08 +0800)
committerTakashi Iwai <tiwai@suse.de>
Sun, 27 Mar 2022 08:32:42 +0000 (10:32 +0200)
commit13095aa0478855a61f7dcbd81b57bdf23d0f9c37
tree41dfa0c153d03c9fa00e3457887c5b5c53a34a0f
parent44ab054273c6d736cf5c451a6ce02ae51cefbad0
ALSA: cs4236: fix an incorrect NULL check on list iterator

The bug is here:
err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev);

The list iterator value 'cdev' will *always* be set and non-NULL
by list_for_each_entry(), so it is incorrect to assume that the
iterator value will be NULL if the list is empty or no element
is found.

To fix the bug, use a new variable 'iter' as the list iterator,
while use the original variable 'cdev' as a dedicated pointer
to point to the found element. And snd_card_cs423x_pnp() itself
has NULL check for cdev.

Cc: stable@vger.kernel.org
Fixes: 8c4da11ae033d ("ALSA: cs4236: cs4232 and cs4236 driver merge to solve PnP BIOS detection")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220327060822.4735-1-xiam0nd.tong@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/isa/cs423x/cs4236.c