gluster-devel
[Top][All Lists]
Advanced

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

[Gluster-devel] Unchecked malloc


From: Emmanuel Dreyfus
Subject: [Gluster-devel] Unchecked malloc
Date: Thu, 13 Feb 2014 02:13:56 +0100
User-agent: MacSOUP/2.7 (unregistered for 2581 days)

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 
2) as I do not know enough about glusterfs internals, I cannot propose
appropriate outcomes for various failures. Clearly someone else more
knowledgable than me has to handle it.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
address@hidden



reply via email to

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