qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/6] kvm: g_malloc() can't fail, bury dead error


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 3/6] kvm: g_malloc() can't fail, bury dead error handling
Date: Wed, 28 Jan 2015 11:59:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Thomas Huth <address@hidden> writes:

> On Tue, 27 Jan 2015 17:38:28 +0100
> Markus Armbruster <address@hidden> wrote:
>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>  kvm-all.c | 4 ----
>>  1 file changed, 4 deletions(-)
>> 
>> diff --git a/kvm-all.c b/kvm-all.c
>> index 2f21a4e..05a79c2 100644
>> --- a/kvm-all.c
>> +++ b/kvm-all.c
>> @@ -2070,10 +2070,6 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong 
>> addr,
>>          }
>> 
>>          bp = g_malloc(sizeof(struct kvm_sw_breakpoint));
>> -        if (!bp) {
>> -            return -ENOMEM;
>> -        }
>> -
>>          bp->pc = addr;
>>          bp->use_count = 1;
>>          err = kvm_arch_insert_sw_breakpoint(cpu, bp);
>
> I think I'd also use g_try_malloc() here instead. Looks like an error
> gets reported to GDB when this function returns with an error code, so
> returning -ENOMEM should be ok here, shouldn't it?

Same rationale as for PATCH 2.  sizeof(struct kvm_sw_breakpoint) is 40
bytes on my system.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]