From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Cc: <jglisse@redhat.com>, <apopple@nvidia.com>, <sfr@canb.auug.org.au>
Subject: [PATCH -next] lib/test_hmm: check page after calling xa_untag_pointer()
Date: Wed, 26 May 2021 22:05:22 +0800 [thread overview]
Message-ID: <20210526140522.2535643-1-yangyingliang@huawei.com> (raw)
Check page after calling xa_untag_pointer() to fix compile warning:
lib/test_hmm.c:631:16: warning: variable ‘page’ set but not used [-Wunused-but-set-variable]
631 | struct page *page;
| ^~~~
Fixes: 8b2a105c3794 ("mm: selftests for exclusive device memory")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
lib/test_hmm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 74d69f87691e..87db37e51d7b 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -632,7 +632,7 @@ static int dmirror_check_atomic(struct dmirror *dmirror, unsigned long start,
entry = xa_load(&dmirror->pt, pfn);
page = xa_untag_pointer(entry);
- if (xa_pointer_tag(entry) == DPT_XA_TAG_ATOMIC)
+ if (!page || xa_pointer_tag(entry) == DPT_XA_TAG_ATOMIC)
return -EPERM;
}
--
2.25.1
next reply other threads:[~2021-05-26 14:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 14:05 Yang Yingliang [this message]
2021-05-26 19:59 ` Ralph Campbell
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=20210526140522.2535643-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=apopple@nvidia.com \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sfr@canb.auug.org.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox