mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fushuai Wang <wangfushuai@baidu.com>
To: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Cc: <viro@zeniv.linux.org.uk>, <brauner@kernel.org>, <jack@suse.cz>,
	Fushuai Wang <wangfushuai@baidu.com>
Subject: [PATCH] coredump: simplify coredump_skip()
Date: Mon, 11 Aug 2025 15:51:55 +0800	[thread overview]
Message-ID: <20250811075155.7637-1-wangfushuai@baidu.com> (raw)

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


             reply	other threads:[~2025-08-11  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11  7:51 Fushuai Wang [this message]
2025-08-11 13:41 ` Christian Brauner

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=20250811075155.7637-1-wangfushuai@baidu.com \
    --to=wangfushuai@baidu.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 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®