ALSA: usb-audio: Fix possible NULL pointer dereference in snd_usb_pcm_has_fixed_rate()
Jaroslav Kysela
maintainerPATCH 1/1 ALSA: usb-audio: Fix possible NULL pointer dereference in snd_usb_pcm_has_fixed_rate()
The subs function argument may be NULL, so do not use it before the NULL check.
Fixes 291e9da91403 ("ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format()")
Reported-by coverity-bot <[email protected]>
Signed-off-by Jaroslav Kysela <[email protected]>
--- sound/usb/pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/pcm.c +2 -1
@@ -160,11 +160,12 @@ find_substream_format(struct snd_usb_substream *subs,bool snd_usb_pcm_has_fixed_rate (struct snd_usb_substream *subs) {const struct audioformat *fp; -struct snd_usb_audio *chip = subs->stream->chip; +struct snd_usb_audio *chip;int rate =-1 ;if (!subs)return false; + chip = subs->stream->chip;if (!(chip->quirk_flags &QUIRK_FLAG_FIXED_RATE ))return false;list_for_each_entry (fp, &subs->fmt_list, list) {
Signature · 1 line
2.39.0
Takashi Iwai
AppliedQuoted 7 lines · Jaroslav Kysela
The subs function argument may be NULL, so do not use it before the NULL check.
Fixes 291e9da91403 ("ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format()")Reported-by coverity-bot <[email protected]>Signed-off-by Jaroslav Kysela <[email protected]>
Applied, thanks.
Takashi