diff options
author | Xi Wang <xi.wang@gmail.com> | 2012-11-13 17:12:11 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-14 02:03:27 -0500 |
commit | 9af4e7fedab490fec6e831912859d6be92e9140d (patch) | |
tree | ce8f13d7939d964dd7739c35af3af2d917cf3290 /sound/core/oss | |
parent | 1762a59d8e8b5e99f6f4a0f292b40f3cacb108ba (diff) |
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>
Diffstat (limited to 'sound/core/oss')
-rw-r--r-- | sound/core/oss/pcm_plugin.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 71cc3ddf5c15..f0d7b1566a10 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c | |||
@@ -199,12 +199,13 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin) | |||
199 | snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames) | 199 | snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames) |
200 | { | 200 | { |
201 | struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; | 201 | struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; |
202 | int stream = snd_pcm_plug_stream(plug); | 202 | int stream; |
203 | 203 | ||
204 | if (snd_BUG_ON(!plug)) | 204 | if (snd_BUG_ON(!plug)) |
205 | return -ENXIO; | 205 | return -ENXIO; |
206 | if (drv_frames == 0) | 206 | if (drv_frames == 0) |
207 | return 0; | 207 | return 0; |
208 | stream = snd_pcm_plug_stream(plug); | ||
208 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 209 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
209 | plugin = snd_pcm_plug_last(plug); | 210 | plugin = snd_pcm_plug_last(plug); |
210 | while (plugin && drv_frames > 0) { | 211 | while (plugin && drv_frames > 0) { |