Commit 701ef320 authored by Xi Wang's avatar Xi Wang Committed by Takashi Iwai

ALSA: core: fix NULL checking in snd_pcm_plug_slave_size()

The dereference snd_pcm_plug_stream(plug) should come after the NULL
check snd_BUG_ON(!plug).
Signed-off-by: default avatarXi Wang <xi.wang@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9af4e7fe
...@@ -231,13 +231,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc ...@@ -231,13 +231,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
{ {
struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
snd_pcm_sframes_t frames; snd_pcm_sframes_t frames;
int stream = snd_pcm_plug_stream(plug); int stream;
if (snd_BUG_ON(!plug)) if (snd_BUG_ON(!plug))
return -ENXIO; return -ENXIO;
if (clt_frames == 0) if (clt_frames == 0)
return 0; return 0;
frames = clt_frames; frames = clt_frames;
stream = snd_pcm_plug_stream(plug);
if (stream == SNDRV_PCM_STREAM_PLAYBACK) { if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
plugin = snd_pcm_plug_first(plug); plugin = snd_pcm_plug_first(plug);
while (plugin && frames > 0) { while (plugin && frames > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment