From: Wei Yongjun <weiyj.lk@gmail.com> To: agraf@suse.com, pbonzini@redhat.com, rkrcmar@redhat.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Cc: Wei Yongjun <weiyongjun1@huawei.com>, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce() Date: Tue, 7 Feb 2017 15:34:07 +0000 [thread overview] Message-ID: <20170207153407.22325-1-weiyj.lk@gmail.com> (raw) From: Wei Yongjun <weiyongjun1@huawei.com> 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 <weiyongjun1@huawei.com> --- arch/powerpc/kvm/book3s_64_vio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index d71f872..8a4a3f0 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c @@ -173,8 +173,10 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *), GFP_KERNEL); - if (!stt) + if (!stt) { + ret = -ENOMEM; goto fail; + } stt->liobn = args->liobn; stt->page_shift = args->page_shift; @@ -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);
WARNING: multiple messages have this Message-ID (diff)
From: Wei Yongjun <weiyj.lk@gmail.com> To: agraf@suse.com, pbonzini@redhat.com, rkrcmar@redhat.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Cc: Wei Yongjun <weiyongjun1@huawei.com>, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce() Date: Tue, 07 Feb 2017 15:34:07 +0000 [thread overview] Message-ID: <20170207153407.22325-1-weiyj.lk@gmail.com> (raw) From: Wei Yongjun <weiyongjun1@huawei.com> 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 <weiyongjun1@huawei.com> --- arch/powerpc/kvm/book3s_64_vio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index d71f872..8a4a3f0 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c @@ -173,8 +173,10 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *), GFP_KERNEL); - if (!stt) + if (!stt) { + ret = -ENOMEM; goto fail; + } stt->liobn = args->liobn; stt->page_shift = args->page_shift; @@ -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);
next reply other threads:[~2017-02-07 15:34 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-07 15:34 Wei Yongjun [this message] 2017-02-07 15:34 ` [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce() Wei Yongjun 2017-02-08 9:48 ` Paul Mackerras 2017-02-08 9:48 ` Paul Mackerras 2017-02-08 16:20 ` [PATCH -next v2] KVM: PPC: fix " Wei Yongjun 2017-02-08 16:20 ` Wei Yongjun 2017-02-08 16:20 ` Wei Yongjun
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170207153407.22325-1-weiyj.lk@gmail.com \ --to=weiyj.lk@gmail.com \ --cc=agraf@suse.com \ --cc=benh@kernel.crashing.org \ --cc=kvm-ppc@vger.kernel.org \ --cc=kvm@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=mpe@ellerman.id.au \ --cc=paulus@samba.org \ --cc=pbonzini@redhat.com \ --cc=rkrcmar@redhat.com \ --cc=weiyongjun1@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.