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@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; }