Thread (28 messages) 28 messages, 7 authors, 2011-03-30

Re: kmemleak for MIPS

From: Daniel Baluta <hidden>
Date: 2011-03-30 11:25:03
Also in: linux-mips, lkml

We have:
UDP hash table entries: 128 (order: 0, 4096 bytes)
CONFIG_BASE_SMALL=0
udp_table_init looks like:

        if (!CONFIG_BASE_SMALL)
                table->hash = alloc_large_system_hash(name, .. &table->mask);
        /*
         * Make sure hash table has the minimum size
         */

Since CONFIG_BASE_SMALL is 0, we are allocating the hash using
alloc_large_system
Then:
        if (CONFIG_BASE_SMALL || table->mask < UDP_HTABLE_SIZE_MIN - 1) {
                table->hash = kmalloc();

table->mask is 127, and UDP_HTABLE_SIZE_MIN is 256, so we are allocating again
table->hash without freeing already allocated memory.

We could free table->hash, before allocating the memory with kmalloc.
I don't fully understand the condition table->mask < UDP_HTABLE_SIZE_MIN - 1.

Eric?

thanks,
Daniel.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help