Skip to contentSkip to conversation

use qemu_malloc and friends consistently

PATCH [email protected] 1 participant 1 message May 29, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 11 lines · ----- "malc
Quoted 2 lines · Anthony Liguori

I disagree. The wrong reason we introduced oom_check() was because

we

Quoted 1 line

don't trust people to check returns. Why would we trust them to

check

Quoted 1 line

size arguments especially when a lot of programmers are not going

to

Quoted 2 lines

check size arguments by convention?

Quoted 7 lines
Quoted 3 lines

If we really want to fix up code, we can do so in a more benign way.

Instead of aborting, let's return malloc(1) and printf a warning.

Then

Quoted 1 line

we can fix sites without worrying about killing guests.

Printf a warning saying what exactly?

I guess it should say malloc(0) was used with a backtrace to be usefull ...

Quoted 7 lines
Quoted 2 lines

If we only have to fixup a few sites, then yeah, we can switch to abort(). If it turns out there's a ton of these things and the code

is

Quoted 1 line

uglier, then we can give up and just accept these semantics.

We _already_ use abort, and so far only one caller was caught and taken care of.

I am going to throw in a few more potential cases with my proposed patch. But not that many ...