* [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce()
@ 2017-02-07 15:34 ` Wei Yongjun
0 siblings, 0 replies; 7+ messages in thread
From: Wei Yongjun @ 2017-02-07 15:34 UTC (permalink / raw)
To: agraf, pbonzini, rkrcmar, benh, paulus, mpe
Cc: Wei Yongjun, kvm-ppc, kvm, linuxppc-dev
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);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce()
@ 2017-02-07 15:34 ` Wei Yongjun
0 siblings, 0 replies; 7+ messages in thread
From: Wei Yongjun @ 2017-02-07 15:34 UTC (permalink / raw)
To: agraf, pbonzini, rkrcmar, benh, paulus, mpe
Cc: Wei Yongjun, kvm-ppc, kvm, linuxppc-dev
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);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce()
2017-02-07 15:34 ` Wei Yongjun
@ 2017-02-08 9:48 ` Paul Mackerras
-1 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2017-02-08 9:48 UTC (permalink / raw)
To: Wei Yongjun
Cc: agraf, pbonzini, rkrcmar, benh, mpe, Wei Yongjun, kvm-ppc, kvm,
linuxppc-dev
On Tue, Feb 07, 2017 at 03:34:07PM +0000, Wei Yongjun wrote:
> 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;
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.
> + }
>
> 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);
Paul.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce()
@ 2017-02-08 9:48 ` Paul Mackerras
0 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2017-02-08 9:48 UTC (permalink / raw)
To: Wei Yongjun
Cc: agraf, pbonzini, rkrcmar, benh, mpe, Wei Yongjun, kvm-ppc, kvm,
linuxppc-dev
On Tue, Feb 07, 2017 at 03:34:07PM +0000, Wei Yongjun wrote:
> 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;
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.
> + }
>
> 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);
Paul.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next v2] KVM: PPC: fix error return code in kvm_vm_ioctl_create_spapr_tce()
2017-02-07 15:34 ` Wei Yongjun
(?)
@ 2017-02-08 16:20 ` Wei Yongjun
-1 siblings, 0 replies; 7+ messages in thread
From: Wei Yongjun @ 2017-02-08 16:20 UTC (permalink / raw)
To: agraf, pbonzini, rkrcmar, benh, paulus, mpe
Cc: linuxppc-dev, Wei Yongjun, kvm, kvm-ppc
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index d71f872..ab9d14c 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -171,6 +171,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
goto fail;
}
+ ret = -ENOMEM;
stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *),
GFP_KERNEL);
if (!stt)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH -next v2] KVM: PPC: fix error return code in kvm_vm_ioctl_create_spapr_tce()
@ 2017-02-08 16:20 ` Wei Yongjun
0 siblings, 0 replies; 7+ messages in thread
From: Wei Yongjun @ 2017-02-08 16:20 UTC (permalink / raw)
To: agraf, pbonzini, rkrcmar, benh, paulus, mpe
Cc: Wei Yongjun, kvm-ppc, kvm, linuxppc-dev
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index d71f872..ab9d14c 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -171,6 +171,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
goto fail;
}
+ ret = -ENOMEM;
stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *),
GFP_KERNEL);
if (!stt)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH -next v2] KVM: PPC: fix error return code in kvm_vm_ioctl_create_spapr_tce()
@ 2017-02-08 16:20 ` Wei Yongjun
0 siblings, 0 replies; 7+ messages in thread
From: Wei Yongjun @ 2017-02-08 16:20 UTC (permalink / raw)
To: agraf, pbonzini, rkrcmar, benh, paulus, mpe
Cc: linuxppc-dev, Wei Yongjun, kvm, kvm-ppc
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index d71f872..ab9d14c 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -171,6 +171,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
goto fail;
}
+ ret = -ENOMEM;
stt = kzalloc(sizeof(*stt) + npages * sizeof(struct page *),
GFP_KERNEL);
if (!stt)
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-08 16:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 15:34 [PATCH -next] KVM: PPC: Fix error return code in kvm_vm_ioctl_create_spapr_tce() Wei Yongjun
2017-02-07 15:34 ` 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
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.