diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-04-11 14:12:13 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-04-11 18:58:52 +0300 |
commit | e50abbf788c239d529f9ab81e325f8e8f8432c9d (patch) | |
tree | c9b84f157369ad9c3bc5ff0845790461ca3c651a /drivers/virt/coco | |
parent | e720ea52e85c9d00cf8c5769795d0a3e585524f6 (diff) | |
download | linux-e50abbf788c239d529f9ab81e325f8e8f8432c9d.tar.xz |
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/coco')
-rw-r--r-- | drivers/virt/coco/sevguest/sevguest.c | 2 |
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); |