[alsa-devel] [PATCH 23/39] ALSA: seq: optimize get_queue_info function to new design
Takashi Sakamoto
o-takashi at sakamocchi.jp
Sun Aug 7 11:48:59 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 | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 167be82..5756e2c 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1546,29 +1546,22 @@ static int seq_ioctl_delete_queue(struct snd_seq_client *client, void *arg)
}
/* GET_QUEUE_INFO ioctl() */
-static int seq_ioctl_get_queue_info(struct snd_seq_client *client,
- void __user *arg)
+static int seq_ioctl_get_queue_info(struct snd_seq_client *client, void *arg)
{
- struct snd_seq_queue_info info;
+ struct snd_seq_queue_info *info = arg;
struct snd_seq_queue *q;
- if (copy_from_user(&info, arg, sizeof(info)))
- return -EFAULT;
-
- q = queueptr(info.queue);
+ q = queueptr(info->queue);
if (q == NULL)
return -EINVAL;
- memset(&info, 0, sizeof(info));
- info.queue = q->queue;
- info.owner = q->owner;
- info.locked = q->locked;
- strlcpy(info.name, q->name, sizeof(info.name));
+ memset(info, 0, sizeof(*info));
+ info->queue = q->queue;
+ info->owner = q->owner;
+ info->locked = q->locked;
+ strlcpy(info->name, q->name, sizeof(info->name));
queuefree(q);
- if (copy_to_user(arg, &info, sizeof(info)))
- return -EFAULT;
-
return 0;
}
--
2.7.4
More information about the Alsa-devel
mailing list