Skip to content

Commit 82ce8e2

Browse files
chleroyakpm00
authored andcommitted
set_memory: add __must_check to generic stubs
Following query shows that architectures that don't provide asm/set_memory.h don't use set_memory_...() functions. $ git grep set_memory_ alpha arc csky hexagon loongarch m68k microblaze mips nios2 openrisc parisc sh sparc um xtensa Following query shows that all core users of set_memory_...() functions always take returned value into account: $ git grep -w -e set_memory_ro -e set_memory_rw -e set_memory_x -e set_memory_nx -e set_memory_rox `find . -maxdepth 1 -type d | grep -v arch | grep /` set_memory_...() functions can fail, leaving the memory attributes unchanged. Make sure all callers check the returned code. Link: KSPP#7 Link: https://lkml.kernel.org/r/6a89ffc69666de84721216947c6b6c7dcca39d7d.1725723347.git.christophe.leroy@csgroup.eu Signed-off-by: Christophe Leroy <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Kees Cook <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 659c55e commit 82ce8e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/linux/set_memory.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
99
#include <asm/set_memory.h>
1010
#else
11-
static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
12-
static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
13-
static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
14-
static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
11+
static inline int __must_check set_memory_ro(unsigned long addr, int numpages) { return 0; }
12+
static inline int __must_check set_memory_rw(unsigned long addr, int numpages) { return 0; }
13+
static inline int __must_check set_memory_x(unsigned long addr, int numpages) { return 0; }
14+
static inline int __must_check set_memory_nx(unsigned long addr, int numpages) { return 0; }
1515
#endif
1616

1717
#ifndef set_memory_rox

0 commit comments

Comments
 (0)