Roel Kluin <roel.kl...@gmail.com> writes:

> Allocations may fail, prevent NULL dereferences.
>
> Signed-off-by: Roel Kluin <roel.kl...@gmail.com>
> ---
> In several sections of fs/btrfs code a kmalloc() occurs without a
> check whether it succeeded. this potentially leads to dereferences
> of a NULL pointer. Are there reasons why we do not check the
> allocations? Did I choose an incorrect way to err out? please
> review.

Yes, the erroring out needs much more work because often
the callers don't handle errors and it can need quite a lot of surgery
Until that is done it's actually better to oops than to silently
leak resources. BUG_ON(name == NULL) is also fairly useless
because it oopses anyways in a obvious way.

I had some patches to add more error handling for ENOMEM, but it's
fairly complicated. Should probably resurrect my old patchkit. It
still wasn't fully complete.

-Andi


-- 
a...@linux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to