Skip to content

Commit 9af4e7f

Browse files
xiwtiwai
authored andcommitted
ALSA: core: fix NULL checking in snd_pcm_plug_client_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 1762a59 commit 9af4e7f

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
@@ -199,12 +199,13 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin)
199199
snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames)
200200
{
201201
struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
202-
int stream = snd_pcm_plug_stream(plug);
202+
int stream;
203203

204204
if (snd_BUG_ON(!plug))
205205
return -ENXIO;
206206
if (drv_frames == 0)
207207
return 0;
208+
stream = snd_pcm_plug_stream(plug);
208209
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
209210
plugin = snd_pcm_plug_last(plug);
210211
while (plugin && drv_frames > 0) {

0 commit comments

Comments
 (0)