X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=mm%2Fnommu.c;h=8687973462bbea8becddfe0941eb94fab60ce304;hb=525995d77ca08dfc2ba6f8e606f93694271dbd66;hp=9876fa0c3ad30e75d842f965ac4417e66be6f07a;hpb=4646575daf21f544fc2f7e8d90d8c488948fcc7c;p=linux-2.6-block.git diff --git a/mm/nommu.c b/mm/nommu.c index 9876fa0c3ad3..8687973462bb 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1143,9 +1143,6 @@ static int do_mmap_private(struct vm_area_struct *vma, if (ret < rlen) memset(base + ret, 0, rlen - ret); - } else { - /* if it's an anonymous mapping, then just clear it */ - memset(base, 0, rlen); } return 0; @@ -1343,6 +1340,11 @@ unsigned long do_mmap_pgoff(struct file *file, goto error_just_free; add_nommu_region(region); + /* clear anonymous mappings that don't ask for uninitialized data */ + if (!vma->vm_file && !(flags & MAP_UNINITIALIZED)) + memset((void *)region->vm_start, 0, + region->vm_end - region->vm_start); + /* okay... we have a mapping; now we have to register it */ result = vma->vm_start;