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

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

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 30aac28..6c1b406 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1773,17 +1773,14 @@ static int seq_ioctl_get_queue_client(struct snd_seq_client *client, void *arg)
 
 
 /* SET_QUEUE_CLIENT ioctl() */
-static int seq_ioctl_set_queue_client(struct snd_seq_client *client,
-				      void __user *arg)
+static int seq_ioctl_set_queue_client(struct snd_seq_client *client, void *arg)
 {
+	struct snd_seq_queue_client *info = arg;
 	int err;
-	struct snd_seq_queue_client info;
-
-	if (copy_from_user(&info, arg, sizeof(info)))
-		return -EFAULT;
 
-	if (info.used >= 0) {
-		err = snd_seq_queue_use(info.queue, client->number, info.used);
+	if (info->used >= 0) {
+		err = snd_seq_queue_use(info->queue, client->number,
+					info->used);
 		if (err < 0)
 			return err;
 	}
-- 
2.7.4



More information about the Alsa-devel mailing list