mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
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: 291e9da914
("ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format()")
Reported-by: coverity-bot <keescook@chromium.org>
Link: https://lore.kernel.org/alsa-devel/202301121424.4A79A485@keescook/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230113085311.623325-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
84aa3059f4
commit
92a9c0ad86
1 changed files with 2 additions and 1 deletions
|
@ -160,11 +160,12 @@ find_substream_format(struct snd_usb_substream *subs,
|
||||||
bool snd_usb_pcm_has_fixed_rate(struct snd_usb_substream *subs)
|
bool snd_usb_pcm_has_fixed_rate(struct snd_usb_substream *subs)
|
||||||
{
|
{
|
||||||
const struct audioformat *fp;
|
const struct audioformat *fp;
|
||||||
struct snd_usb_audio *chip = subs->stream->chip;
|
struct snd_usb_audio *chip;
|
||||||
int rate = -1;
|
int rate = -1;
|
||||||
|
|
||||||
if (!subs)
|
if (!subs)
|
||||||
return false;
|
return false;
|
||||||
|
chip = subs->stream->chip;
|
||||||
if (!(chip->quirk_flags & QUIRK_FLAG_FIXED_RATE))
|
if (!(chip->quirk_flags & QUIRK_FLAG_FIXED_RATE))
|
||||||
return false;
|
return false;
|
||||||
list_for_each_entry(fp, &subs->fmt_list, list) {
|
list_for_each_entry(fp, &subs->fmt_list, list) {
|
||||||
|
|
Loading…
Reference in a new issue