arm64/syscall: Remove duplicate declaration

Message ID 20231109101958.225593-1-kevin.brodsky@arm.com
State New
Headers
Series arm64/syscall: Remove duplicate declaration |

Commit Message

Kevin Brodsky Nov. 9, 2023, 10:19 a.m. UTC
  Commit 6ac19f96515e ("arm64: avoid prototype warnings for syscalls")
added missing declarations to various syscall wrapper macros.
It however proved a little too zealous in __SYSCALL_DEFINEx(), as
a declaration for __arm64_sys##name was already present.

This likely wouldn't have happened if declarations were consistently
located, ideally just before the corresponding definition.
Accordingly, this patch removes the old declaration line in
__SYSCALL_DEFINEx(), and moves any other declaration that does not
directly precede the corresponding definition.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---
 arch/arm64/include/asm/syscall_wrapper.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Comments

Kevin Brodsky Nov. 9, 2023, 1:47 p.m. UTC | #1
On 09/11/2023 11:19, Kevin Brodsky wrote:
> Commit 6ac19f96515e ("arm64: avoid prototype warnings for syscalls")
> added missing declarations to various syscall wrapper macros.
> It however proved a little too zealous in __SYSCALL_DEFINEx(), as
> a declaration for __arm64_sys##name was already present.
>
> This likely wouldn't have happened if declarations were consistently
> located, ideally just before the corresponding definition.
> Accordingly, this patch removes the old declaration line in
> __SYSCALL_DEFINEx(), and moves any other declaration that does not
> directly precede the corresponding definition.
>
> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> ---
>  arch/arm64/include/asm/syscall_wrapper.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h
> index 17f687510c48..0d1ec3280f89 100644
> --- a/arch/arm64/include/asm/syscall_wrapper.h
> +++ b/arch/arm64/include/asm/syscall_wrapper.h
> @@ -18,10 +18,10 @@
>  #ifdef CONFIG_COMPAT
>  
>  #define COMPAT_SYSCALL_DEFINEx(x, name, ...)						\
> -	asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs);		\
>  	ALLOW_ERROR_INJECTION(__arm64_compat_sys##name, ERRNO);				\
>  	static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));		\
>  	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
> +	asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs);		\

This doesn't make sense, the declaration needs to stay before the call
to ALLOW_ERROR_INJECTION() (I wasn't building with
CONFIG_FUNCTION_ERROR_INJECTION). Will post a v2 that simply removes the
added declaration in __SYSCALL_DEFINEx() without moving existing
declarations - sorry for the noise.

Kevin

>  	asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs)		\
>  	{										\
>  		return __se_compat_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__));	\
> @@ -50,7 +50,6 @@
>  #endif /* CONFIG_COMPAT */
>  
>  #define __SYSCALL_DEFINEx(x, name, ...)						\
> -	asmlinkage long __arm64_sys##name(const struct pt_regs *regs);		\
>  	ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO);			\
>  	static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));		\
>  	static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
> @@ -70,8 +69,8 @@
>  
>  #define SYSCALL_DEFINE0(sname)							\
>  	SYSCALL_METADATA(_##sname, 0);						\
> -	asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused);	\
>  	ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO);			\
> +	asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused);	\
>  	asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
>  
>  #define COND_SYSCALL(name)							\
  

Patch

diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h
index 17f687510c48..0d1ec3280f89 100644
--- a/arch/arm64/include/asm/syscall_wrapper.h
+++ b/arch/arm64/include/asm/syscall_wrapper.h
@@ -18,10 +18,10 @@ 
 #ifdef CONFIG_COMPAT
 
 #define COMPAT_SYSCALL_DEFINEx(x, name, ...)						\
-	asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs);		\
 	ALLOW_ERROR_INJECTION(__arm64_compat_sys##name, ERRNO);				\
 	static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));		\
 	static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
+	asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs);		\
 	asmlinkage long __arm64_compat_sys##name(const struct pt_regs *regs)		\
 	{										\
 		return __se_compat_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__));	\
@@ -50,7 +50,6 @@ 
 #endif /* CONFIG_COMPAT */
 
 #define __SYSCALL_DEFINEx(x, name, ...)						\
-	asmlinkage long __arm64_sys##name(const struct pt_regs *regs);		\
 	ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO);			\
 	static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));		\
 	static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
@@ -70,8 +69,8 @@ 
 
 #define SYSCALL_DEFINE0(sname)							\
 	SYSCALL_METADATA(_##sname, 0);						\
-	asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused);	\
 	ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO);			\
+	asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused);	\
 	asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
 
 #define COND_SYSCALL(name)							\