mm: simplify min_brk handling in brk()
authorXuanye Liu <liuqiye2025@163.com>
Thu, 10 Jul 2025 02:58:58 +0000 (10:58 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 20 Jul 2025 01:59:53 +0000 (18:59 -0700)
commite001ef9652c2d931a1126c9d173ec5ea95e9847a
tree25563ab988d79e0d6ffaa1e373fac89597d3fa17
parentc809579374f47c8273eaf22a40674ae547f39254
mm: simplify min_brk handling in brk()

Set min_brk to mm->start_brk by default, and override it with mm->end_data
only when CONFIG_COMPAT_BRK is enabled and brk_randomized is false.

This makes the logic clearer with no functional change.

Link: https://lkml.kernel.org/r/20250710025859.926355-1-liuqiye2025@163.com
Signed-off-by: Xuanye Liu <liuqiye2025@163.com>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c