[PATCH] libmtd: make malloc failures fatal

Mike Frysinger vapier at gentoo.org
Sat Oct 2 13:29:52 EDT 2010


On Sat, Oct 2, 2010 at 10:19, Artem Bityutskiy wrote:
> On Fri, 2010-10-01 at 13:13 -0400, Mike Frysinger wrote:
>> This converts libmtd to the common xalloc helpers and in doing so, makes
>> memory allocation failures fatal rather than returning an error to the
>> caller.  I think this is acceptable behavior.
>>
>> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
>> ---
>>  lib/libmtd.c        |   26 ++++++--------------------
>>  lib/libmtd_legacy.c |    8 +-------
>>  2 files changed, 7 insertions(+), 27 deletions(-)
>
> I am not 100% sure this is a good idea, but probably for allocations it
> is ok - they are so unlikely to fail, and if they do, we are screwed
> anyway. But for other situation we should return errors, I think.

right, i'm only thinking of OOM errors should we simply die.  all
other errors should return.
-mike



More information about the linux-mtd mailing list