[Gluster-devel] Unchecked malloc
Vijay Bellur
vbellur at redhat.com
Thu Feb 13 09:09:17 UTC 2014
On 02/13/2014 06:43 AM, Emmanuel Dreyfus wrote:
> Hi
>
> I have hit another unchecked malloc bug in 3.5.0beta3:
>
> libglusterfs/src/mem-pool.c:mem_get()
> ptr = GF_CALLOC (1, mem_pool->padded_sizeof_type,
> gf_common_mt_mem_pool);
>
> /* Memory coming from the heap need not be transformed from a
> * chunkhead to a usable pointer since it is not coming from
> * the pool.
> */
> }
> fwd_addr_out:
> pool_ptr = mem_pool_from_ptr (ptr);
> *pool_ptr = (struct mem_pool *)mem_pool;
>
> And here it crashes because pool_ptr was derived from ptr, which is NULL.
>
> I submitted a change for this (http://review.gluster.org/6796), which was
> reviewed -1, and indeed it is not good enough because:
> 1) it is incomplete, as unchecked mallocs are now very common in glusterfs
> code, and
Though it is not complete, we need to start somewhere. I don't think we
will ever have a single patchset that addresses this problem completely.
I am okay with reviving this patch, address the review comments and
merge it.
We could set up a wiki page to track this cleanup on a per component basis.
-Vijay
More information about the Gluster-devel
mailing list