2021-02-04 08:08:20

by Zheng Yongjun

[permalink] [raw]
Subject: [PATCH -next] KVM: s390: Return the correct errno code

When valloc failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <[email protected]>
---
arch/s390/kvm/interrupt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 2f177298c663..6b7acc27cfa2 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -2252,7 +2252,7 @@ static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
*/
buf = vzalloc(len);
if (!buf)
- return -ENOBUFS;
+ return -ENOMEM;

max_irqs = len / sizeof(struct kvm_s390_irq);

--
2.22.0


2021-02-04 23:32:42

by Cornelia Huck

[permalink] [raw]
Subject: Re: [PATCH -next] KVM: s390: Return the correct errno code

On Thu, 4 Feb 2021 16:05:23 +0800
Zheng Yongjun <[email protected]> wrote:

> When valloc failed, should return ENOMEM rather than ENOBUF.
>
> Signed-off-by: Zheng Yongjun <[email protected]>
> ---
> arch/s390/kvm/interrupt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index 2f177298c663..6b7acc27cfa2 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
> @@ -2252,7 +2252,7 @@ static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
> */
> buf = vzalloc(len);
> if (!buf)
> - return -ENOBUFS;
> + return -ENOMEM;
>
> max_irqs = len / sizeof(struct kvm_s390_irq);
>

This breaks a user space interface (see the comment right above the
vzalloc).

2021-02-04 23:33:05

by Christian Borntraeger

[permalink] [raw]
Subject: Re: [PATCH -next] KVM: s390: Return the correct errno code

On 04.02.21 09:32, Cornelia Huck wrote:
> On Thu, 4 Feb 2021 16:05:23 +0800
> Zheng Yongjun <[email protected]> wrote:
>
>> When valloc failed, should return ENOMEM rather than ENOBUF.
>>
>> Signed-off-by: Zheng Yongjun <[email protected]>
>> ---
>> arch/s390/kvm/interrupt.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
>> index 2f177298c663..6b7acc27cfa2 100644
>> --- a/arch/s390/kvm/interrupt.c
>> +++ b/arch/s390/kvm/interrupt.c
>> @@ -2252,7 +2252,7 @@ static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
>> */
>> buf = vzalloc(len);
>> if (!buf)
>> - return -ENOBUFS;
>> + return -ENOMEM;
>>
>> max_irqs = len / sizeof(struct kvm_s390_irq);
>>
>
> This breaks a user space interface (see the comment right above the
> vzalloc).


Right. Please do not send (generated?) patches without looking at the code
that you are patching.

2021-02-04 23:34:52

by Zheng Yongjun

[permalink] [raw]
Subject: 答复: [PATCH -next] KVM: s390: Return the c orrect errno code

Thanks for your advice, I will do this better later :)

-----邮件原件-----
发件人: Christian Borntraeger [mailto:[email protected]]
发送时间: 2021年2月4日 16:42
收件人: Cornelia Huck <[email protected]>; zhengyongjun <[email protected]>
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
主题: Re: [PATCH -next] KVM: s390: Return the correct errno code

On 04.02.21 09:32, Cornelia Huck wrote:
> On Thu, 4 Feb 2021 16:05:23 +0800
> Zheng Yongjun <[email protected]> wrote:
>
>> When valloc failed, should return ENOMEM rather than ENOBUF.
>>
>> Signed-off-by: Zheng Yongjun <[email protected]>
>> ---
>> arch/s390/kvm/interrupt.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
>> index 2f177298c663..6b7acc27cfa2 100644
>> --- a/arch/s390/kvm/interrupt.c
>> +++ b/arch/s390/kvm/interrupt.c
>> @@ -2252,7 +2252,7 @@ static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
>> */
>> buf = vzalloc(len);
>> if (!buf)
>> - return -ENOBUFS;
>> + return -ENOMEM;
>>
>> max_irqs = len / sizeof(struct kvm_s390_irq);
>>
>
> This breaks a user space interface (see the comment right above the
> vzalloc).


Right. Please do not send (generated?) patches without looking at the code that you are patching.