gluster-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gluster-devel] Unchecked malloc


From: Vijay Bellur
Subject: Re: [Gluster-devel] Unchecked malloc
Date: Thu, 13 Feb 2014 14:39:17 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]