Commit e50abbf7 authored by Yang Yingliang's avatar Yang Yingliang Committed by Borislav Petkov

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: fce96cf0 ("virt: Add SEV-SNP guest driver")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
Link: https://lore.kernel.org/r/20220411111213.1477853-1-yangyingliang@huawei.com
parent e720ea52
...@@ -581,7 +581,7 @@ static void *alloc_shared_pages(size_t sz) ...@@ -581,7 +581,7 @@ static void *alloc_shared_pages(size_t sz)
int ret; int ret;
page = alloc_pages(GFP_KERNEL_ACCOUNT, get_order(sz)); page = alloc_pages(GFP_KERNEL_ACCOUNT, get_order(sz));
if (IS_ERR(page)) if (!page)
return NULL; return NULL;
ret = set_memory_decrypted((unsigned long)page_address(page), npages); ret = set_memory_decrypted((unsigned long)page_address(page), npages);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment