@@ -173,8 +173,10 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,stt=kzalloc(sizeof(*stt)+npages*sizeof(structpage*),GFP_KERNEL);-if(!stt)+if(!stt){+ret=-ENOMEM;gotofail;
I think it would be better to set ret unconditionally to -ENOMEM
before the if; that would save you one line here and make the second
hunk unnecessary.
@@ -184,8 +186,10 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, for (i = 0; i < npages; i++) { stt->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO);- if (!stt->pages[i])+ if (!stt->pages[i]) {+ ret = -ENOMEM; goto fail;+ } } kvm_get_kvm(kvm);
From: Wei Yongjun <redacted>
Fix to return error code -ENOMEM from the memory alloc error handling
case instead of 0, as done elsewhere in this function.
Signed-off-by: Wei Yongjun <redacted>
---
arch/powerpc/kvm/book3s_64_vio.c | 1 +
1 file changed, 1 insertion(+)