[PATCH 3/8] KVM: gmem: Fix kvm_gmem_issue_arch_invalidate()
From: isaku . yamahata
Date: Tue Aug 15 2023 - 13:20:10 EST
From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
__filemap_get_folio() can return error. Use IS_ERR_OR_NULL.
Signed-off-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
---
virt/kvm/guest_mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/guest_mem.c b/virt/kvm/guest_mem.c
index c81d2bb9ae93..ed03f1d12172 100644
--- a/virt/kvm/guest_mem.c
+++ b/virt/kvm/guest_mem.c
@@ -53,7 +53,7 @@ static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index)
struct folio *folio;
folio = kvm_gmem_get_huge_folio(inode, index);
- if (!folio) {
+ if (IS_ERR_OR_NULL(folio)) {
folio = filemap_grab_folio(inode->i_mapping, index);
if (!folio)
return NULL;
--
2.25.1