[PATCH] mm/fault: make some is_*** function return bool

From: Hao Ge
Date: Mon Mar 18 2024 - 01:52:48 EST


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

Signed-off-by: Hao Ge <gehao@xxxxxxxxxx>
---
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