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

Takashi Sakamoto o-takashi at sakamocchi.jp
Sun Aug 7 11:49:07 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 | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 667ad23..30aac28 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1757,23 +1757,17 @@ static int seq_ioctl_set_queue_timer(struct snd_seq_client *client, void *arg)
 
 
 /* GET_QUEUE_CLIENT ioctl() */
-static int seq_ioctl_get_queue_client(struct snd_seq_client *client,
-				      void __user *arg)
+static int seq_ioctl_get_queue_client(struct snd_seq_client *client, void *arg)
 {
-	struct snd_seq_queue_client info;
+	struct snd_seq_queue_client *info = arg;
 	int used;
 
-	if (copy_from_user(&info, arg, sizeof(info)))
-		return -EFAULT;
-
-	used = snd_seq_queue_is_used(info.queue, client->number);
+	used = snd_seq_queue_is_used(info->queue, client->number);
 	if (used < 0)
 		return -EINVAL;
-	info.used = used;
-	info.client = client->number;
+	info->used = used;
+	info->client = client->number;
 
-	if (copy_to_user(arg, &info, sizeof(info)))
-		return -EFAULT;
 	return 0;
 }
 
-- 
2.7.4



More information about the Alsa-devel mailing list