[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230228170339.GA15021@redhat.com>
Date: Tue, 28 Feb 2023 18:03:40 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Gregory Price <gourry.memverge@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
avagin@...il.com, peterz@...radead.org, luto@...nel.org,
krisman@...labora.com, tglx@...utronix.de, corbet@....net,
shuah@...nel.org, Gregory Price <gregory.price@...verge.com>
Subject: Re: [PATCH v12 2/3] ptrace,syscall_user_dispatch: checkpoint/restore
support for SUD
Gregory,
I can't resist, I have a couple of cosmetic nits.
On 02/24, Gregory Price wrote:
>
> +int syscall_user_dispatch_get_config(struct task_struct *task, unsigned long size,
> + void __user *data)
> +{
> + struct syscall_user_dispatch *sd = &task->syscall_dispatch;
> + struct ptrace_sud_config config;
> +
> + if (size != sizeof(struct ptrace_sud_config))
> + return -EINVAL;
> +
> + if (test_task_syscall_work(task, SYSCALL_USER_DISPATCH))
> + config.mode = PR_SYS_DISPATCH_ON;
> + else
> + config.mode = PR_SYS_DISPATCH_OFF;
> +
> + config.offset = sd->offset;
> + config.len = sd->len;
> + config.selector = (__u64)(uintptr_t)sd->selector;
> +
> + if (copy_to_user(data, &config, sizeof(config)))
Let me repeat, do not mix sizeof(struct ptrace_sud_config) and sizeof(config).
Perhaps this is just me, but this looks confusing to me. Please use
sizeof(config) both times.
> +int syscall_user_dispatch_set_config(struct task_struct *task, unsigned long size,
> + void __user *data)
> +{
> + int rc;
> + struct ptrace_sud_config cfg;
^^^
Again, this is cosmetic but a bit annoying. Please use either "config" or
"cfg" in both functions to make the naming more consistent.
> + rc = task_set_syscall_user_dispatch(task, cfg.mode, cfg.offset,
> + cfg.len, (char __user *)(uintptr_t)cfg.selector);
rc = task_set_syscall_user_dispatch(task, cfg.mode, cfg.offset, cfg.len,
(char __user *)(uintptr_t)cfg.selector);
looks a bit better to me.
Oleg.
Powered by blists - more mailing lists