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.

fs/proc/namespaces: make ns_entries const

Global variables that are never modified should be "const" so so that
they live in the .rodata section instead of the .data section of the
kernel, gaining the protection of the kernel's strict memory
permissions as described in Documentation/security/self-protection.rst

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Max Kellermann and committed by
Christian Brauner
796667c9 c593b9d6

+3 -3
+3 -3
fs/proc/namespaces.c
··· 12 12 #include "internal.h" 13 13 14 14 15 - static const struct proc_ns_operations *ns_entries[] = { 15 + static const struct proc_ns_operations *const ns_entries[] = { 16 16 #ifdef CONFIG_NET_NS 17 17 &netns_operations, 18 18 #endif ··· 117 117 static int proc_ns_dir_readdir(struct file *file, struct dir_context *ctx) 118 118 { 119 119 struct task_struct *task = get_proc_task(file_inode(file)); 120 - const struct proc_ns_operations **entry, **last; 120 + const struct proc_ns_operations *const *entry, *const *last; 121 121 122 122 if (!task) 123 123 return -ENOENT; ··· 151 151 struct dentry *dentry, unsigned int flags) 152 152 { 153 153 struct task_struct *task = get_proc_task(dir); 154 - const struct proc_ns_operations **entry, **last; 154 + const struct proc_ns_operations *const *entry, *const *last; 155 155 unsigned int len = dentry->d_name.len; 156 156 struct dentry *res = ERR_PTR(-ENOENT); 157 157