Commit 7551b5ea authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Jaroslav Kysela <perex@suse.cz>

RME HDSP driver
Fixed wrong assert, added checks for copy_*_user functions
parent 2372814e
...@@ -3810,7 +3810,7 @@ static char *hdsp_channel_buffer_location(hdsp_t *hdsp, ...@@ -3810,7 +3810,7 @@ static char *hdsp_channel_buffer_location(hdsp_t *hdsp,
{ {
int mapped_channel; int mapped_channel;
snd_assert(channel >= 0 || channel < hdsp->max_channels, return NULL); snd_assert(channel >= 0 && channel < hdsp->max_channels, return NULL);
if ((mapped_channel = hdsp->channel_map[channel]) < 0) { if ((mapped_channel = hdsp->channel_map[channel]) < 0) {
return NULL; return NULL;
...@@ -3833,7 +3833,8 @@ static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel, ...@@ -3833,7 +3833,8 @@ static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel,
channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel); channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
snd_assert(channel_buf != NULL, return -EIO); snd_assert(channel_buf != NULL, return -EIO);
copy_from_user(channel_buf + pos * 4, src, count * 4); if (copy_from_user(channel_buf + pos * 4, src, count * 4))
return -EFAULT;
return count; return count;
} }
...@@ -3847,7 +3848,8 @@ static int snd_hdsp_capture_copy(snd_pcm_substream_t *substream, int channel, ...@@ -3847,7 +3848,8 @@ static int snd_hdsp_capture_copy(snd_pcm_substream_t *substream, int channel,
channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel); channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel);
snd_assert(channel_buf != NULL, return -EIO); snd_assert(channel_buf != NULL, return -EIO);
copy_to_user(dst, channel_buf + pos * 4, count * 4); if (copy_to_user(dst, channel_buf + pos * 4, count * 4))
return -EFAULT;
return count; return count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment