[PATCH linu-next] mm/fault: fix comparing pointer to 0

cgel.zte@gmail.com posted 1 patch 3 years, 6 months ago
arch/alpha/mm/fault.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH linu-next] mm/fault: fix comparing pointer to 0
Posted by cgel.zte@gmail.com 3 years, 6 months ago
From: Xu Panda <xu.panda@zte.com.cn>

Do not use assignment in if condition,
and using "!P" instead of comparing pointer to 0.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
---
 arch/alpha/mm/fault.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index ef427a6bdd1a..09d0d069059b 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -194,7 +194,8 @@ do_page_fault(unsigned long address, unsigned long mmcsr,

  no_context:
        /* Are we prepared to handle this fault as an exception?  */
-       if ((fixup = search_exception_tables(regs->pc)) != 0) {
+       fixup = search_exception_tables(regs->pc);
+       if (!fixup) {
                unsigned long newpc;
                newpc = fixup_exception(dpf_reg, fixup, regs->pc);
                regs->pc = newpc;
-- 
2.15.2