Skip to contentSkip to conversation

printk: Fix incorrect __user type in proc_dointvec_minmax_sysadmin()

PATCH In review Mickaël Salaün 3 participants 4 messages Feb 3, 2022 – Feb 4, 2022 Printk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk: Fix incorrect __user type in proc_dointvec_minmax_sysadmin()

From: Mickaël Salaün <[email protected]>

The move of proc_dointvec_minmax_sysadmin() from kernel/sysctl.c to kernel/printk/sysctl.c introduced an incorrect __user attribute to the buffer argument. I spotted this change in [1] as well as the kernel test robot. Revert this change to please sparse:

kernel/printk/sysctl.c:20:51: warning: incorrect type in argument 3 (different address spaces)
kernel/printk/sysctl.c:20:51: expected void *
kernel/printk/sysctl.c:20:51: got void [noderef] __user *buffer

Fixes faaa357a55e0 ("printk: move printk sysctl to printk/sysctl.c")
Cc Andrew Morton <[email protected]>
Cc John Ogness <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Xiaoming Ni <[email protected]>
---
 kernel/printk/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/sysctl.c +1 -1
index 653ae04aab7f..c228343eeb97 100644
@@ -12,7 +12,7 @@
 static const int ten_thousand = 10000;
 
 static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
-				void __user *buffer, size_t *lenp, loff_t *ppos)
+				void *buffer, size_t *lenp, loff_t *ppos)
 {
 	if (write && !capable(CAP_SYS_ADMIN))
 		return -EPERM;

base-commit: 88808fbbead481aedb46640a5ace69c58287f56a

Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Mickaël Salaün

The move of proc_dointvec_minmax_sysadmin() from kernel/sysctl.c to kernel/printk/sysctl.c introduced an incorrect __user attribute to the buffer argument. I spotted this change in [1] as well as the kernel test robot. Revert this change to please sparse:

kernel/printk/sysctl.c:20:51: warning: incorrect type in argument 3 (different address spaces)
kernel/printk/sysctl.c:20:51: expected void *
kernel/printk/sysctl.c:20:51: got void [noderef] __user *buffer

Quoted 13 lines
Fixes faaa357a55e0 ("printk: move printk sysctl to printk/sysctl.c")
Cc Andrew Morton <[email protected]>
Cc John Ogness <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Xiaoming Ni <[email protected]>
#2 lore raw
Quoted 25 lines · Sergey Senozhatsky
Quoted 9 lines · Mickaël Salaün

The move of proc_dointvec_minmax_sysadmin() from kernel/sysctl.c to kernel/printk/sysctl.c introduced an incorrect __user attribute to the buffer argument. I spotted this change in [1] as well as the kernel test robot. Revert this change to please sparse:

kernel/printk/sysctl.c:20:51: warning: incorrect type in argument 3 (different address spaces)
kernel/printk/sysctl.c:20:51: expected void *
kernel/printk/sysctl.c:20:51: got void [noderef] __user *buffer

Quoted 13 lines
Fixes faaa357a55e0 ("printk: move printk sysctl to printk/sysctl.c")
Cc Andrew Morton <[email protected]>
Cc John Ogness <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Xiaoming Ni <[email protected]>
#3 lore raw
In reply to Sergey Senozhatsky
Quoted 24 lines · Sergey Senozhatsky
Quoted 9 lines · Mickaël Salaün

The move of proc_dointvec_minmax_sysadmin() from kernel/sysctl.c to kernel/printk/sysctl.c introduced an incorrect __user attribute to the buffer argument. I spotted this change in [1] as well as the kernel test robot. Revert this change to please sparse:

kernel/printk/sysctl.c:20:51: warning: incorrect type in argument 3 (different address spaces)
kernel/printk/sysctl.c:20:51: expected void *
kernel/printk/sysctl.c:20:51: got void [noderef] __user *buffer

Quoted 13 lines
Fixes faaa357a55e0 ("printk: move printk sysctl to printk/sysctl.c")
Cc Andrew Morton <[email protected]>
Cc John Ogness <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Xiaoming Ni <[email protected]>
Quoted 1 line

Luis