[PATCH 6/7] lib/math.c: Fix possible crash

Alexander Aring alex.aring at gmail.com
Mon Feb 17 02:23:48 EST 2014


On Mon, Feb 17, 2014 at 08:08:09AM +0100, Sascha Hauer wrote:
> On Sun, Feb 16, 2014 at 08:40:49AM +0400, Alexander Shiyan wrote:
> > Crash can be caused if xzalloc() for "numstack" fails.
> 
> xzalloc doesn't fail.
> 
Some little offtopic to this issue:

I am falling sometimes in the same trap and then it reminds me "xzalloc
will occur a panic when internal malloc fails". In the world of barebox
we need to think a little bit different than in the world of linux. But
this is actually a behaviour what we don't want, we want to think in
linux way, when you programming barebox.

On the other hand, bootloader is a bootloader and need little code and
this reduce a many error branches of barebox so "xzalloc" is just a
great idea.

I want to mention that, Alexander is not alone. :-)

...maybe some codestyle checkers will detected this as a missing error
handling.

- Alex



More information about the barebox mailing list