Skip to contentSkip to conversation

coredump: simplify coredump_skip()

PATCH In review Fushuai Wang 2 participants 2 messages Aug 11, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coredump: simplify coredump_skip()

Replace the multi-if conditional check with a single return statement.

---
 fs/coredump.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
fs/coredump.c +2 -7
index fedbead956ed..3fcbf108099b 100644
@@ -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)
Signature · 1 line
2.36.1
#1 lore raw
Quoted 4 lines · Fushuai Wang

Replace the multi-if conditional check with a single return statement.

---

This is a matter of taste. Thanks for the idea but the checks on separate lines make it easier to read.