All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/fault: make some is_*** function return bool
@ 2024-03-18  5:52 Hao Ge
  0 siblings, 0 replies; only message in thread
From: Hao Ge @ 2024-03-18  5:52 UTC (permalink / raw)
  To: dave.hansen, luto, peterz, tglx, bp, hpa; +Cc: linux-kernel, gehao618, Hao Ge

is_*** function can return bool,so we change it

Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 arch/x86/mm/fault.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index d6375b3c633b..591efd80a3e2 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -415,31 +415,31 @@ static void dump_pagetable(unsigned long address)
  * Note we only handle faults in kernel here.
  * Does nothing on 32-bit.
  */
-static int is_errata93(struct pt_regs *regs, unsigned long address)
+static bool is_errata93(struct pt_regs *regs, unsigned long address)
 {
 #if defined(CONFIG_X86_64) && defined(CONFIG_CPU_SUP_AMD)
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD
 	    || boot_cpu_data.x86 != 0xf)
-		return 0;
+		return false;
 
 	if (user_mode(regs))
-		return 0;
+		return false;
 
 	if (address != regs->ip)
-		return 0;
+		return false;
 
 	if ((address >> 32) != 0)
-		return 0;
+		return false;
 
 	address |= 0xffffffffUL << 32;
 	if ((address >= (u64)_stext && address <= (u64)_etext) ||
 	    (address >= MODULES_VADDR && address <= MODULES_END)) {
 		printk_once(errata93_warning);
 		regs->ip = address;
-		return 1;
+		return true;
 	}
 #endif
-	return 0;
+	return false;
 }
 
 /*
@@ -450,27 +450,27 @@ static int is_errata93(struct pt_regs *regs, unsigned long address)
  * are not reachable. Just detect this case and return.  Any code
  * segment in LDT is compatibility mode.
  */
-static int is_errata100(struct pt_regs *regs, unsigned long address)
+static bool is_errata100(struct pt_regs *regs, unsigned long address)
 {
 #ifdef CONFIG_X86_64
 	if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) && (address >> 32))
-		return 1;
+		return true;
 #endif
-	return 0;
+	return false;
 }
 
 /* Pentium F0 0F C7 C8 bug workaround: */
-static int is_f00f_bug(struct pt_regs *regs, unsigned long error_code,
+static bool is_f00f_bug(struct pt_regs *regs, unsigned long error_code,
 		       unsigned long address)
 {
 #ifdef CONFIG_X86_F00F_BUG
 	if (boot_cpu_has_bug(X86_BUG_F00F) && !(error_code & X86_PF_USER) &&
 	    idt_is_f00f_address(address)) {
 		handle_invalid_op(regs);
-		return 1;
+		return true;
 	}
 #endif
-	return 0;
+	return false;
 }
 
 static void show_ldttss(const struct desc_ptr *gdt, const char *name, u16 index)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-18  5:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18  5:52 [PATCH] mm/fault: make some is_*** function return bool Hao Ge

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.