All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-ia64@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Oleg Nesterov <oleg@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,
	Ingo Molnar <mingo@kernel.org>,
	linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org,
	linux-hexagon@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-snps-arc@lists.infradead.org,
	Dave Martin <dave.martin@arm.com>,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-xtensa@linux-xtensa.org, Kees Cook <keescook@chromium.org>,
	Roland McGrath <roland@hack.frob.com>,
	linux-um@lists.infradead.org, linux-mips@vger.kernel.org,
	openrisc@lists.librecores.org, Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>


[-- Attachment #1.1: Type: text/plain, Size: 3659 bytes --]

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Roland McGrath <roland@hack.frob.com>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-arch@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Dominik Brodowski <linux@dominikbrodowski.net>,
	Andy Lutomirski <luto@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Palmer Dabbelt <palmer@sifive.com>,
	Dave Martin <dave.martin@arm.com>,
	linux-snps-arc@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-c6x-dev@linux-c6x.org,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org,
	linux-mips@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	openrisc@lists.librecores.org, linux-parisc@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
	sparclinux@vger.kernel.org, linux-um@lists.infradead.org,
	linux-xtensa@linux-xtensa.org
Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
Message-ID: <20190404181849.xl0vRUZR5Pjd_8Ikfk28EIjgniB1F33X1eYmxUIlhtM@z> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>

[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-ia64@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Oleg Nesterov <oleg@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,
	Ingo Molnar <mingo@kernel.org>,
	linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org,
	linux-hexagon@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-snps-arc@lists.infradead.org,
	Dave Martin <dave.martin@arm.com>,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-xtensa@linux-xtensa.org, Kees Cook <keescook@chromium.org>,
	Roland McGrath <roland@hack.frob.com>,
	linux-um@lists.infradead.org, linux-mips@vger.kernel.org,
	openrisc@lists.librecores.org, Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 04 Apr 2019 18:18:49 +0000	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>

[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-ia64@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Oleg Nesterov <oleg@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,
	Ingo Molnar <mingo@kernel.org>,
	linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org,
	linux-hexagon@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-snps-arc@lists.infradead.org,
	Dave Martin <dave.martin@arm.com>,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-xtensa@linux-xtensa.org, Kees Cook <keescook@chromium.org>,
	Roland McGrath <roland@hack.frob.com>,
	linux-um@lists.infradead.org, linux-mips@vger.kernel.org,
	openrisc@lists.librecores.org, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	nios2-dev@lists.rocketboards.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>


[-- Attachment #1.1: Type: text/plain, Size: 3659 bytes --]

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: ldv@altlinux.org (Dmitry V. Levin)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>

On Mon, Apr 01, 2019@09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt at goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540 at altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv at altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-snps-arc/attachments/20190404/f6b30284/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-ia64@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Oleg Nesterov <oleg@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,
	Ingo Molnar <mingo@kernel.org>,
	linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org,
	linux-hexagon@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-snps-arc@lists.infradead.org,
	Dave Martin <dave.martin@arm.com>,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-xtensa@linux-xtensa.org, Kees Cook <keescook@chromium.org>,
	Roland McGrath <roland@hack.frob.com>,
	linux-um@lists.infradead.org, linux-mips@vger.kernel.org,
	openrisc@lists.librecores.org, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	nios2-dev@lists.rocketboards.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>


[-- Attachment #1.1: Type: text/plain, Size: 3659 bytes --]

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry V. Levin <ldv@altlinux.org>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540 at altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20190404/f6b30284/attachment-0001.sig>

WARNING: multiple messages have this Message-ID (diff)
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-ia64@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Oleg Nesterov <oleg@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,
	Ingo Molnar <mingo@kernel.org>,
	linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-c6x-dev@linux-c6x.org, linux-sh@vger.kernel.org,
	linux-hexagon@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-snps-arc@lists.infradead.org,
	Dave Martin <dave.martin@arm.com>,
	uclinux-h8-devel@lists.sourceforge.jp,
	linux-xtensa@linux-xtensa.org, Kees Cook <keescook@chromium.org>,
	Roland McGrath <roland@hack.frob.com>,
	linux-um@lists.infradead.org, linux-mips@vger.kernel.org,
	openrisc@lists.librecores.org, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	nios2-dev@lists.rocketboards.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
Date: Thu, 4 Apr 2019 21:18:49 +0300	[thread overview]
Message-ID: <20190404181849.GA8711@altlinux.org> (raw)
In-Reply-To: <20190401134421.442323029@goodmis.org>

[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]

On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
> 
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org

FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
 
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.

> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
>   * syscall_set_arguments - change system call parameter value
>   * @task:	task of interest, must be in system call entry tracing
>   * @regs:	task_pt_regs() of @task
> - * @i:		argument index [0,5]
> - * @n:		number of arguments; n+i must be [1,6].
>   * @args:	array of argument values to store
>   *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
>   *
>   * It's only valid to call this when @task is stopped for tracing on
>   * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
>   */
>  void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> -			   unsigned int i, unsigned int n,
>  			   const unsigned long *args)
>  {
> -	if (n == 0)
> -		return;
> -
> -	if (i + n > SYSCALL_MAX_ARGS) {
> -		pr_warn("%s called with max args %d, handling only %d\n",
> -			__func__, i + n, SYSCALL_MAX_ARGS);
> -		n = SYSCALL_MAX_ARGS - i;
> -	}
> -
> -	if (i == 0) {
> -		regs->orig_r0 = args[0];
> -		args++;
> -		i++;
> -		n--;
> -	}
> +	regs->orig_r0 = args[0];
> +	args++;
>  
> -	memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
> +	memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
>  }

A shorter and slightly more readable equivalent of the last memcpy is

	memcpy(&regs->uregs[1], args, 5 * sizeof(args[0]));

> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>  
>  static inline void syscall_set_arguments(struct task_struct *task,
>  					 struct pt_regs *regs,
> -					 unsigned int i, unsigned int n,
>  					 const unsigned long *args)
>  {
> -	BUG_ON(i + n > 6);
> +	unsigned int n = 6;
> +
>  	while (n-- > 0)
> -		if (i + n > 0)
> -			regs->gprs[2 + i + n] = args[n];
> -	if (i == 0)
> -		regs->orig_gpr2 = args[0];
> +		if (n > 0)
> +			regs->gprs[2 + n] = args[n];
> +	regs->orig_gpr2 = args[0];
>  }

A shorter and slightly more readable equivalent of the loop is

	while (--n > 0)
		regs->gprs[2 + n] = args[n];


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  parent reply	other threads:[~2019-04-04 18:18 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 13:41 [PATCH 0/6 v3] sycalls: Remove args i and n from syscall_get_arguments() Steven Rostedt
2019-04-01 13:41 ` [PATCH 1/6 v3] ptrace: Remove maxargs from task_current_syscall() Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-04  7:52   ` Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-01 13:41 ` [PATCH 2/6 v3] tracing/syscalls: Pass in hardcoded 6 into syscall_get_arguments() Steven Rostedt
2019-04-01 13:41 ` [PATCH 3/6 v3] riscv: Fix syscall_get_arguments() and syscall_set_arguments() Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-04 14:02   ` Dmitry V. Levin
2019-04-04 14:02     ` Dmitry V. Levin
2019-04-04 14:02     ` Dmitry V. Levin
2019-04-04 14:26     ` Steven Rostedt
2019-04-04 14:26       ` Steven Rostedt
2019-04-04 14:26       ` Steven Rostedt
2019-04-04 23:29       ` Palmer Dabbelt
2019-04-04 23:29         ` Palmer Dabbelt
2019-04-01 13:41 ` [PATCH 4/6 v3] csky: " Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-04 14:02   ` Dmitry V. Levin
2019-04-04 14:02     ` Dmitry V. Levin
2019-04-04 14:28     ` Steven Rostedt
2019-04-04 14:28       ` Steven Rostedt
2019-04-01 13:41 ` [PATCH 5/6 v3] syscalls: Remove start and number from syscall_get_arguments() args Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` [OpenRISC] " Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-03 22:51   ` Paul Burton
2019-04-03 22:51     ` Paul Burton
2019-04-03 22:51     ` [OpenRISC] " Paul Burton
2019-04-03 22:51     ` Paul Burton
2019-04-03 22:51     ` Paul Burton
2019-04-03 22:51     ` Paul Burton
2019-04-04  7:52   ` Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-04  7:52     ` [OpenRISC] " Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-04  7:52     ` Thomas Gleixner
2019-04-04 18:17   ` Dmitry V. Levin
2019-04-04 18:17     ` Dmitry V. Levin
2019-04-04 18:17     ` [OpenRISC] " Dmitry V. Levin
2019-04-04 18:17     ` Dmitry V. Levin
2019-04-04 18:17     ` Dmitry V. Levin
2019-04-04 18:17     ` Dmitry V. Levin
2019-04-04 18:17     ` Dmitry V. Levin
2019-04-04 18:17     ` Dmitry V. Levin
2019-04-04 21:06     ` Steven Rostedt
2019-04-04 21:06       ` Steven Rostedt
2019-04-04 21:06       ` [OpenRISC] " Steven Rostedt
2019-04-04 21:06       ` Steven Rostedt
2019-04-04 21:06       ` Steven Rostedt
2019-04-04 21:06       ` Steven Rostedt
2019-04-04 21:06       ` Steven Rostedt
2019-04-04 21:06       ` Steven Rostedt
2019-04-04 18:56   ` Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-04 18:56     ` [OpenRISC] " Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-04 18:56     ` Max Filippov
2019-04-01 13:41 ` [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` [OpenRISC] " Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-01 13:41   ` Steven Rostedt
2019-04-04  7:53   ` Thomas Gleixner
2019-04-04  7:53     ` Thomas Gleixner
2019-04-04  7:53     ` [OpenRISC] " Thomas Gleixner
2019-04-04  7:53     ` Thomas Gleixner
2019-04-04  7:53     ` Thomas Gleixner
2019-04-04  7:53     ` Thomas Gleixner
2019-04-04  7:53     ` Thomas Gleixner
2019-04-04  7:53     ` Thomas Gleixner
2019-04-04 18:18   ` Dmitry V. Levin [this message]
2019-04-04 18:18     ` Dmitry V. Levin
2019-04-04 18:18     ` [OpenRISC] " Dmitry V. Levin
2019-04-04 18:18     ` Dmitry V. Levin
2019-04-04 18:18     ` Dmitry V. Levin
2019-04-04 18:18     ` Dmitry V. Levin
2019-04-04 18:18     ` Dmitry V. Levin
2019-04-04 18:18     ` Dmitry V. Levin
2019-04-04 18:55   ` Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 18:55     ` [OpenRISC] " Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 18:55     ` Max Filippov
2019-04-04 13:28 ` [PATCH 0/6 v3] sycalls: Remove args i and n from syscall_get_arguments() Steven Rostedt
2019-04-05  1:24   ` Linus Torvalds
2019-04-05  1:24     ` Linus Torvalds
2019-04-05 14:07     ` Steven Rostedt
2019-04-05 14:07       ` Steven Rostedt
2019-04-05  8:58 ` Will Deacon
2019-04-05  8:58   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190404181849.GA8711@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=bp@alien8.de \
    --cc=dave.martin@arm.com \
    --cc=gustavo@embeddedor.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-c6x-dev@linux-c6x.org \
    --cc=linux-hexagon@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linux@dominikbrodowski.net \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=openrisc@lists.librecores.org \
    --cc=palmer@sifive.com \
    --cc=peterz@infradead.org \
    --cc=roland@hack.frob.com \
    --cc=rostedt@goodmis.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=uclinux-h8-devel@lists.sourceforge.jp \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.