summaryrefslogtreecommitdiff
path: root/drivers/virt
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-04-11 19:12:13 +0800
committerBorislav Petkov <bp@suse.de>2022-04-11 17:58:52 +0200
commite50abbf788c239d529f9ab81e325f8e8f8432c9d (patch)
treec9b84f157369ad9c3bc5ff0845790461ca3c651a /drivers/virt
parente720ea52e85c9d00cf8c5769795d0a3e585524f6 (diff)
virt: sevguest: Fix return value check in alloc_shared_pages()
If alloc_pages() fails, it returns a NULL pointer. Replace the wrong IS_ERR() check with the proper 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> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Brijesh Singh <brijesh.singh@amd.com> Link: https://lore.kernel.org/r/20220411111213.1477853-1-yangyingliang@huawei.com
Diffstat (limited to 'drivers/virt')
-rw-r--r--drivers/virt/coco/sevguest/sevguest.c2
1 files changed, 1 insertions, 1 deletions
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);