Skip to content

Commit c9bd4a8

Browse files
Murad Masimovtiwai
authored andcommitted
ALSA: hda/cs8409: Fix possible NULL dereference
If snd_hda_gen_add_kctl fails to allocate memory and returns NULL, then NULL pointer dereference will occur in the next line. Since dolphin_fixups function is a hda_fixup function which is not supposed to return any errors, add simple check before dereference, ignore the fail. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 20e5077 ("ALSA: hda/cs8409: Add support for dolphin") Signed-off-by: Murad Masimov <m.masimov@maxima.ru> Link: https://patch.msgid.link/20241010221649.1305-1-m.masimov@maxima.ru Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ad6639f commit c9bd4a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sound/pci/hda/patch_cs8409.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,8 +1403,9 @@ void dolphin_fixups(struct hda_codec *codec, const struct hda_fixup *fix, int ac
14031403
kctrl = snd_hda_gen_add_kctl(&spec->gen, "Line Out Playback Volume",
14041404
&cs42l42_dac_volume_mixer);
14051405
/* Update Line Out kcontrol template */
1406-
kctrl->private_value = HDA_COMPOSE_AMP_VAL_OFS(DOLPHIN_HP_PIN_NID, 3, CS8409_CODEC1,
1407-
HDA_OUTPUT, CS42L42_VOL_DAC) | HDA_AMP_VAL_MIN_MUTE;
1406+
if (kctrl)
1407+
kctrl->private_value = HDA_COMPOSE_AMP_VAL_OFS(DOLPHIN_HP_PIN_NID, 3, CS8409_CODEC1,
1408+
HDA_OUTPUT, CS42L42_VOL_DAC) | HDA_AMP_VAL_MIN_MUTE;
14081409
cs8409_enable_ur(codec, 0);
14091410
snd_hda_codec_set_name(codec, "CS8409/CS42L42");
14101411
break;

0 commit comments

Comments
 (0)