* [PATCH] reboot: add missing break to switch statement for LINUX_REBOOT_CMD_HALT
@ 2024-08-14 14:24 Enno Onneken
2024-08-14 15:47 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Enno Onneken @ 2024-08-14 14:24 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, kernel-janitors, Enno Onneken
All switch-cases should be isolated from each other due to shutting
down/rebooting the kernel in different ways.
In order to fully isolate this case (like all the others are), this patch
adds a "break;" after do_exit(0); .
Fixes: 15d94b82565e ("reboot: move shutdown/reboot related functions to kernel/reboot.c")
Signed-off-by: Enno Onneken <ennoonneken@outlook.de>
---
kernel/reboot.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/reboot.c b/kernel/reboot.c
index f05dbde2c93f..05dc02748c06 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -765,6 +765,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
case LINUX_REBOOT_CMD_HALT:
kernel_halt();
do_exit(0);
+ break;
case LINUX_REBOOT_CMD_POWER_OFF:
kernel_power_off();
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] reboot: add missing break to switch statement for LINUX_REBOOT_CMD_HALT
2024-08-14 14:24 [PATCH] reboot: add missing break to switch statement for LINUX_REBOOT_CMD_HALT Enno Onneken
@ 2024-08-14 15:47 ` Dan Carpenter
2024-08-14 18:12 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-08-14 15:47 UTC (permalink / raw)
To: Enno Onneken; +Cc: akpm, linux-kernel, kernel-janitors
On Wed, Aug 14, 2024 at 04:24:45PM +0200, Enno Onneken wrote:
> All switch-cases should be isolated from each other due to shutting
> down/rebooting the kernel in different ways.
> In order to fully isolate this case (like all the others are), this patch
> adds a "break;" after do_exit(0); .
This patch is obviously harmless but the commit message is not clear what the
motivation is. "missing break" in the subject is misleading.
do_exit() is annotated as a __noreturn function so it's already "fully
isolated". It sounds like you are using a tool which doesn't understand the
no return attributes. Better to fix that instead.
>
> Fixes: 15d94b82565e ("reboot: move shutdown/reboot related functions to kernel/reboot.c")
This isn't a bugfix so a Fixes tag isn't appropriate.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] reboot: add missing break to switch statement for LINUX_REBOOT_CMD_HALT
2024-08-14 15:47 ` Dan Carpenter
@ 2024-08-14 18:12 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-08-14 18:12 UTC (permalink / raw)
To: Enno Onneken; +Cc: akpm, linux-kernel, kernel-janitors
Please don't drop the lists from the CC.
To be honest, I wouldn't bother with this patch but lots of people send lots of
patches that I probably wouldn't send and I send patches that they wouldn't
send.
If you want to resend it that's fine, but the commit message should say
something like, "The break statement isn't required for after a do_exit() call,
because it is a __noreturn function. However, other do_exit() paths in this
switch() statement have a break statement so it looks weird. Let's make this
consistent. This change has no effect on runtime."
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-14 18:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14 14:24 [PATCH] reboot: add missing break to switch statement for LINUX_REBOOT_CMD_HALT Enno Onneken
2024-08-14 15:47 ` Dan Carpenter
2024-08-14 18:12 ` Dan Carpenter
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®