All of lore.kernel.org
 help / color / mirror / Atom feed
From: cgel.zte@gmail.com
To: richard.henderson@linaro.org
Cc: ink@jurassic.park.msu.ru, mattst88@gmail.com,
	akpm@linux-foundation.org, zhengqi.arch@bytedance.com,
	ebiederm@xmission.com, hannes@cmpxchg.org,
	catalin.marinas@arm.com, peterx@redhat.com,
	linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xu Panda <xu.panda@zte.com.cn>, Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH linu-next V2] mm/fault: fix comparing pointer to 0
Date: Sun, 18 Sep 2022 15:29:12 +0000	[thread overview]
Message-ID: <20220918152912.210112-1-xu.panda@zte.com.cn> (raw)

From: Xu Panda <xu.panda@zte.com.cn>

Do not use assignment in if condition,
and comparing pointer whith NULL 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..bb3fe2949313 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 != NULL) {
                unsigned long newpc;
                newpc = fixup_exception(dpf_reg, fixup, regs->pc);
                regs->pc = newpc;
-- 
2.15.2


             reply	other threads:[~2022-09-18 15:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18 15:29 cgel.zte [this message]
2022-09-18 21:57 ` [PATCH linu-next V2] mm/fault: fix comparing pointer to 0 Eric W. Biederman

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=20220918152912.210112-1-xu.panda@zte.com.cn \
    --to=cgel.zte@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=ebiederm@xmission.com \
    --cc=hannes@cmpxchg.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattst88@gmail.com \
    --cc=peterx@redhat.com \
    --cc=richard.henderson@linaro.org \
    --cc=xu.panda@zte.com.cn \
    --cc=zealci@zte.com.cn \
    --cc=zhengqi.arch@bytedance.com \
    /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 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.