[alsa-devel] [PATCH 28/39] ALSA: seq: optimize set_queue_tempo function to new design

Takashi Sakamoto o-takashi at sakamocchi.jp
Sun Aug 7 11:49:04 CEST 2016


In former commit, actual operations of each ioctl command get argument
in kernel space. Copying from/to user space is performed outside of
the function.

This commit optimizes to the new design.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 sound/core/seq/seq_clientmgr.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 2338468..a90a4a3 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1677,16 +1677,12 @@ int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo)
 
 EXPORT_SYMBOL(snd_seq_set_queue_tempo);
 
-static int seq_ioctl_set_queue_tempo(struct snd_seq_client *client,
-				     void __user *arg)
+static int seq_ioctl_set_queue_tempo(struct snd_seq_client *client, void *arg)
 {
+	struct snd_seq_queue_tempo *tempo = arg;
 	int result;
-	struct snd_seq_queue_tempo tempo;
-
-	if (copy_from_user(&tempo, arg, sizeof(tempo)))
-		return -EFAULT;
 
-	result = snd_seq_set_queue_tempo(client->number, &tempo);
+	result = snd_seq_set_queue_tempo(client->number, tempo);
 	return result < 0 ? result : 0;
 }
 
-- 
2.7.4



More information about the Alsa-devel mailing list