* [PATCH] coredump: simplify coredump_skip()
@ 2025-08-11 7:51 Fushuai Wang
2025-08-11 13:41 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Fushuai Wang @ 2025-08-11 7:51 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel; +Cc: viro, brauner, jack, Fushuai Wang
Replace the multi-if conditional check with a single return statement.
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
fs/coredump.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/coredump.c b/fs/coredump.c
index fedbead956ed..3fcbf108099b 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1077,13 +1077,8 @@ static void coredump_cleanup(struct core_name *cn, struct coredump_params *cprm)
static inline bool coredump_skip(const struct coredump_params *cprm,
const struct linux_binfmt *binfmt)
{
- if (!binfmt)
- return true;
- if (!binfmt->core_dump)
- return true;
- if (!__get_dumpable(cprm->mm_flags))
- return true;
- return false;
+ return (!binfmt || !binfmt->core_dump ||
+ !__get_dumpable(cprm->mm_flags));
}
void vfs_coredump(const kernel_siginfo_t *siginfo)
--
2.36.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] coredump: simplify coredump_skip()
2025-08-11 7:51 [PATCH] coredump: simplify coredump_skip() Fushuai Wang
@ 2025-08-11 13:41 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-08-11 13:41 UTC (permalink / raw)
To: Fushuai Wang; +Cc: linux-kernel, linux-fsdevel, viro, jack
On Mon, Aug 11, 2025 at 03:51:55PM +0800, Fushuai Wang wrote:
> Replace the multi-if conditional check with a single return statement.
>
> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
> ---
This is a matter of taste. Thanks for the idea but the checks on
separate lines make it easier to read.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-11 13:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 7:51 [PATCH] coredump: simplify coredump_skip() Fushuai Wang
2025-08-11 13:41 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).