From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: <brijesh.singh@amd.com>, <bp@suse.de>
Subject: [PATCH -next] virt: sevguest: Fix return value check in alloc_shared_pages()
Date: Mon, 11 Apr 2022 19:12:13 +0800 [thread overview]
Message-ID: <20220411111213.1477853-1-yangyingliang@huawei.com> (raw)
If alloc_pages() fails, it returns NULL pointer, replaces
IS_ERR() check with NULL pointer check.
Fixes: fce96cf04430 ("virt: Add SEV-SNP guest driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/virt/coco/sevguest/sevguest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virt/coco/sevguest/sevguest.c b/drivers/virt/coco/sevguest/sevguest.c
index 15afb6ce8d19..aaa6134d1d40 100644
--- a/drivers/virt/coco/sevguest/sevguest.c
+++ b/drivers/virt/coco/sevguest/sevguest.c
@@ -581,7 +581,7 @@ static void *alloc_shared_pages(size_t sz)
int ret;
page = alloc_pages(GFP_KERNEL_ACCOUNT, get_order(sz));
- if (IS_ERR(page))
+ if (!page)
return NULL;
ret = set_memory_decrypted((unsigned long)page_address(page), npages);
--
2.25.1
next reply other threads:[~2022-04-11 11:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 11:12 Yang Yingliang [this message]
2022-04-11 13:58 ` [PATCH -next] virt: sevguest: Fix return value check in alloc_shared_pages() Brijesh Singh
2022-04-11 16:08 ` [tip: x86/sev] " tip-bot2 for Yang Yingliang
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=20220411111213.1477853-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=bp@suse.de \
--cc=brijesh.singh@amd.com \
--cc=linux-kernel@vger.kernel.org \
/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.