[PATCH] s390/mm: Simplify gap clamping in mmap_base() using clamp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mmap_base() has logic to ensure that the variable "gap" stays within the 
range defined by "gap_min" and "gap_max". Replace this with the clamp() 
macro to shorten and simplify code.

Signed-off-by: Qasim Ijaz <qasdev00@xxxxxxxxx>
---
 arch/s390/mm/mmap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 76f376876e0d..a3d3e09a2828 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -63,11 +63,7 @@ static inline unsigned long mmap_base(unsigned long rnd,
 	 */
 	gap_min = SZ_128M;
 	gap_max = (STACK_TOP / 6) * 5;
-
-	if (gap < gap_min)
-		gap = gap_min;
-	else if (gap > gap_max)
-		gap = gap_max;
+	gap = clamp(gap, gap_min, gap_max);
 
 	return PAGE_ALIGN(STACK_TOP - gap - rnd);
 }
-- 
2.39.5





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux