* [PATCH] arm64/kernel: minor coding style tweaks
@ 2021-02-03 5:19 Zhiyuan Dai
2021-02-03 11:31 ` Mark Rutland
0 siblings, 1 reply; 2+ messages in thread
From: Zhiyuan Dai @ 2021-02-03 5:19 UTC (permalink / raw)
To: catalin.marinas, will
Cc: Dave.Martin, broonie, mark.rutland, linux-kernel, Zhiyuan Dai
Fixed two coding style issues in kernel/trap.c
1. spaces required around that '='
2. Missing a blank line after declarations
Signed-off-by: Zhiyuan Dai <daizhiyuan@phytium.com.cn>
---
arch/arm64/kernel/traps.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 6895ce7..4001a39 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -45,7 +45,7 @@
#include <asm/system_misc.h>
#include <asm/sysreg.h>
-static const char *handler[]= {
+static const char *handler[] = {
"Synchronous Abort",
"IRQ",
"FIQ",
@@ -318,6 +318,7 @@ static int call_undef_hook(struct pt_regs *regs)
} else if (compat_thumb_mode(regs)) {
/* 16-bit Thumb instruction */
__le16 instr_le;
+
if (get_user(instr_le, (__le16 __user *)pc))
goto exit;
instr = le16_to_cpu(instr_le);
@@ -332,6 +333,7 @@ static int call_undef_hook(struct pt_regs *regs)
} else {
/* 32-bit ARM instruction */
__le32 instr_le;
+
if (get_user(instr_le, (__le32 __user *)pc))
goto exit;
instr = le32_to_cpu(instr_le);
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64/kernel: minor coding style tweaks
2021-02-03 5:19 [PATCH] arm64/kernel: minor coding style tweaks Zhiyuan Dai
@ 2021-02-03 11:31 ` Mark Rutland
0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2021-02-03 11:31 UTC (permalink / raw)
To: Zhiyuan Dai; +Cc: catalin.marinas, will, Dave.Martin, broonie, linux-kernel
On Wed, Feb 03, 2021 at 01:19:12PM +0800, Zhiyuan Dai wrote:
> Fixed two coding style issues in kernel/trap.c
> 1. spaces required around that '='
This change makes sense to me as a cleanup.
> 2. Missing a blank line after declarations
We're inconsistent w.r.t. this across the tree, and applying this
everywhere would be very churny, but I think it makes sense to be
consistent locally (e.g. within a function).
Currently call_undef_hook() is inconsistent in this respect, but I think
this patch leaves it inconsistent in a different way. Please see below.
> Signed-off-by: Zhiyuan Dai <daizhiyuan@phytium.com.cn>
> ---
> arch/arm64/kernel/traps.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 6895ce7..4001a39 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -45,7 +45,7 @@
> #include <asm/system_misc.h>
> #include <asm/sysreg.h>
>
> -static const char *handler[]= {
> +static const char *handler[] = {
> "Synchronous Abort",
> "IRQ",
> "FIQ",
> @@ -318,6 +318,7 @@ static int call_undef_hook(struct pt_regs *regs)
> } else if (compat_thumb_mode(regs)) {
> /* 16-bit Thumb instruction */
> __le16 instr_le;
> +
> if (get_user(instr_le, (__le16 __user *)pc))
> goto exit;
> instr = le16_to_cpu(instr_le);
Immediately above this we have:
| if (!user_mode(regs)) {
| __le32 instr_le;
| if (get_kernel_nofault(instr_le, (__force __le32 *)pc))
| goto exit;
| instr = le32_to_cpu(instr_le);
... which we should either change at the same time, or not bother with
this at all.
Thanks,
Mark.
> @@ -332,6 +333,7 @@ static int call_undef_hook(struct pt_regs *regs)
> } else {
> /* 32-bit ARM instruction */
> __le32 instr_le;
> +
> if (get_user(instr_le, (__le32 __user *)pc))
> goto exit;
> instr = le32_to_cpu(instr_le);
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-03 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 5:19 [PATCH] arm64/kernel: minor coding style tweaks Zhiyuan Dai
2021-02-03 11:31 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®