Skip to content

Commit

Permalink
ALSA: core: fix NULL checking in snd_pcm_plug_slave_size()
Browse files Browse the repository at this point in the history
The dereference snd_pcm_plug_stream(plug) should come after the NULL
check snd_BUG_ON(!plug).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Xi Wang authored and Takashi Iwai committed Nov 14, 2012
1 parent 9af4e7f commit 701ef32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/core/oss/pcm_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
snd_pcm_sframes_t frames;
int stream = snd_pcm_plug_stream(plug);
int stream;

if (snd_BUG_ON(!plug))
return -ENXIO;
if (clt_frames == 0)
return 0;
frames = clt_frames;
stream = snd_pcm_plug_stream(plug);
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
plugin = snd_pcm_plug_first(plug);
while (plugin && frames > 0) {
Expand Down

0 comments on commit 701ef32

Please sign in to comment.