Re: [PATCH v12 2/3] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux