Skip to content

Commit 09ef528

Browse files
Jaewon31Kimtorvalds
authored andcommitted
mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area
On passing requirement to vm_unmapped_area, arch_get_unmapped_area and arch_get_unmapped_area_topdown did not set align_offset. Internally on both unmapped_area and unmapped_area_topdown, if info->align_mask is 0, then info->align_offset was meaningless. But commit df529ca ("mm: mmap: add trace point of vm_unmapped_area") always prints info->align_offset even though it is uninitialized. Fix this uninitialized value issue by setting it to 0 explicitly. Before: vm_unmapped_area: addr=0x755b155000 err=0 total_vm=0x15aaf0 flags=0x1 len=0x109000 lo=0x8000 hi=0x75eed48000 mask=0x0 ofs=0x4022 After: vm_unmapped_area: addr=0x74a4ca1000 err=0 total_vm=0x168ab1 flags=0x1 len=0x9000 lo=0x8000 hi=0x753d94b000 mask=0x0 ofs=0x0 Signed-off-by: Jaewon Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michel Lespinasse <[email protected]> Cc: Borislav Petkov <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent cf11e85 commit 09ef528

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mm/mmap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
21232123
info.low_limit = mm->mmap_base;
21242124
info.high_limit = mmap_end;
21252125
info.align_mask = 0;
2126+
info.align_offset = 0;
21262127
return vm_unmapped_area(&info);
21272128
}
21282129
#endif
@@ -2164,6 +2165,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
21642165
info.low_limit = max(PAGE_SIZE, mmap_min_addr);
21652166
info.high_limit = arch_get_mmap_base(addr, mm->mmap_base);
21662167
info.align_mask = 0;
2168+
info.align_offset = 0;
21672169
addr = vm_unmapped_area(&info);
21682170

21692171
/*

0 commit comments

Comments
 (0)