Skip to content

Commit 701ef32

Browse files
xiwtiwai
authored andcommitted
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: Xi Wang <xi.wang@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 9af4e7f commit 701ef32

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎sound/core/oss/pcm_plugin.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
231231
{
232232
struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
233233
snd_pcm_sframes_t frames;
234-
int stream = snd_pcm_plug_stream(plug);
234+
int stream;
235235

236236
if (snd_BUG_ON(!plug))
237237
return -ENXIO;
238238
if (clt_frames == 0)
239239
return 0;
240240
frames = clt_frames;
241+
stream = snd_pcm_plug_stream(plug);
241242
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
242243
plugin = snd_pcm_plug_first(plug);
243244
while (plugin && frames > 0) {

0 commit comments

Comments
 (0)