[alsa-devel] [PATCH v2 07/10] ALSA: core: pass audio tstamp config from userspace

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Dec 19 18:25:10 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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index ae2a93a..8f8aab0 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -756,8 +756,16 @@ static int snd_pcm_status_user(struct snd_pcm_substream *substream,
 {
 	struct snd_pcm_status status;
 	int res;
-	
+	u32  audio_tstamp_data;
+	u32  __user *_audio_tstamp_data;
+
+	/* get audio_tstamp_data from user, ignore rest of status structure */
+	_audio_tstamp_data = (u32 __user *)(&_status->audio_tstamp_data);
+	if (get_user(audio_tstamp_data, _audio_tstamp_data))
+		return -EFAULT;
 	memset(&status, 0, sizeof(status));
+	status.audio_tstamp_data = audio_tstamp_data;
+
 	res = snd_pcm_status(substream, &status);
 	if (res < 0)
 		return res;
-- 
1.9.1



More information about the Alsa-devel mailing list