Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

security: use umax() to improve code

Use umax() to reduce the code in update_mmap_min_addr() and improve its
readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
[PM: subj line tweak]
Signed-off-by: Paul Moore <paul@paul-moore.com>

authored by

Qianfeng Rong and committed by
Paul Moore
e73f759d 5816bf42

+2 -4
+2 -4
security/min_addr.c
··· 3 3 #include <linux/mm.h> 4 4 #include <linux/security.h> 5 5 #include <linux/sysctl.h> 6 + #include <linux/minmax.h> 6 7 7 8 /* amount of vm to protect from userspace access by both DAC and the LSM*/ 8 9 unsigned long mmap_min_addr; ··· 17 16 static void update_mmap_min_addr(void) 18 17 { 19 18 #ifdef CONFIG_LSM_MMAP_MIN_ADDR 20 - if (dac_mmap_min_addr > CONFIG_LSM_MMAP_MIN_ADDR) 21 - mmap_min_addr = dac_mmap_min_addr; 22 - else 23 - mmap_min_addr = CONFIG_LSM_MMAP_MIN_ADDR; 19 + mmap_min_addr = umax(dac_mmap_min_addr, CONFIG_LSM_MMAP_MIN_ADDR); 24 20 #else 25 21 mmap_min_addr = dac_mmap_min_addr; 26 22 #endif