Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Xi Wang and committed by
Takashi Iwai
701ef320 9af4e7fe

+2 -1
+2 -1
sound/core/oss/pcm_plugin.c
··· 231 231 { 232 232 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; 233 233 snd_pcm_sframes_t frames; 234 - int stream = snd_pcm_plug_stream(plug); 234 + int stream; 235 235 236 236 if (snd_BUG_ON(!plug)) 237 237 return -ENXIO; 238 238 if (clt_frames == 0) 239 239 return 0; 240 240 frames = clt_frames; 241 + stream = snd_pcm_plug_stream(plug); 241 242 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 242 243 plugin = snd_pcm_plug_first(plug); 243 244 while (plugin && frames > 0) {