Re: [PATCH] nommu arch dont zero the anonymous mapping by adding UNINITIALIZE flag

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Aubrey Li
Date: Friday, March 30, 2007 - 3:34 am

On 3/30/07, David Howells <dhowells@redhat.com> wrote:

Well, I don't understand why we have to clear the allocation memory.
I suggest we just remove the memset(addr, 0, len) operation at all.
Read the malloc manual, you'll get
--------
malloc() allocates size bytes and returns a pointer to the allocated memory.
****The memory is not cleared.****
--------
So, if not clearing the memory causes one application hang/crash,
that's the bug of that application and it need to be fixed.

The patch in my option is:
------------------------------------
diff --git a/mm/nommu.c b/mm/nommu.c
index cbbc137..fe2b6d4 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -759,10 +759,6 @@ static int do_mmap_private(struct vm_are
                /* clear the last little bit */
                if (ret < len)
                        memset(base + ret, 0, len - ret);
-
-       } else {
-               /* if it's an anonymous mapping, then just clear it */
-               memset(base, 0, len);
        }

        return 0;
----------------------------------------

-Aubrey
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] nommu arch dont zero the anonymous mapping by ..., Aubrey Li, (Fri Mar 30, 3:34 am)