[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220411111213.1477853-1-yangyingliang@huawei.com>
Date: Mon, 11 Apr 2022 19:12:13 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>
CC: <brijesh.singh@....com>, <bp@...e.de>
Subject: [PATCH -next] virt: sevguest: Fix return value check in alloc_shared_pages()
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@...wei.com>
Signed-off-by: Yang Yingliang <yangyingliang@...wei.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
Powered by blists - more mailing lists