[alsa-devel] [PATCH RFC 6/9] ALSA: core: pass audio tstamp config from userspace

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Dec 8 23:23:43 CET 2014


Let userspace select audio timestamp config, ignore and zero all
other fields

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 sound/core/pcm_native.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 37a7137..7dcd6bd 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -706,6 +706,7 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
 	struct snd_pcm_runtime *runtime = substream->runtime;
 
 	snd_pcm_stream_lock_irq(substream);
+	memset(status, 0, sizeof(*status));
 	status->state = runtime->status->state;
 	status->suspended_state = runtime->status->suspended_state;
 	if (status->state == SNDRV_PCM_STATE_OPEN)
@@ -757,7 +758,8 @@ static int snd_pcm_status_user(struct snd_pcm_substream *substream,
 	struct snd_pcm_status status;
 	int res;
 	
-	memset(&status, 0, sizeof(status));
+	if (copy_from_user(&status, _status, sizeof(status)))
+		return -EFAULT;
 	res = snd_pcm_status(substream, &status);
 	if (res < 0)
 		return res;
-- 
2.1.0



More information about the Alsa-devel mailing list