lkml.org 
[lkml]   [2022]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/2] printk: console: Support console-specific loglevels
Hi Chris,

I love your patch! Perhaps something to improve:

[auto build test WARNING on 9d882352bac8f2ff3753d691e2dc65fcaf738729]

url: https://github.com/intel-lab-lkp/linux/commits/Chris-Down/printk-console-Per-console-loglevels/20220721-015315
base: 9d882352bac8f2ff3753d691e2dc65fcaf738729
config: riscv-randconfig-s053-20220718 (https://download.01.org/0day-ci/archive/20220722/202207220029.VYxE2uAL-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/fac1dc8424bd6e1ae37f6e180f96ed7e4f44e2fc
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Chris-Down/printk-console-Per-console-loglevels/20220721-015315
git checkout fac1dc8424bd6e1ae37f6e180f96ed7e4f44e2fc
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash kernel/printk/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
>> kernel/printk/sysctl.c:31:47: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@
kernel/printk/sysctl.c:31:47: sparse: expected void *
kernel/printk/sysctl.c:31:47: sparse: got void [noderef] __user *buffer
kernel/printk/sysctl.c:50:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@
kernel/printk/sysctl.c:50:52: sparse: expected void *
kernel/printk/sysctl.c:50:52: sparse: got void [noderef] __user *buffer
kernel/printk/sysctl.c:54:45: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@
kernel/printk/sysctl.c:54:45: sparse: expected void *
kernel/printk/sysctl.c:54:45: sparse: got void [noderef] __user *buffer
>> kernel/printk/sysctl.c:75:35: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )( ... ) @@ got int ( * )( ... ) @@
kernel/printk/sysctl.c:75:35: sparse: expected int ( [usertype] *proc_handler )( ... )
kernel/printk/sysctl.c:75:35: sparse: got int ( * )( ... )
kernel/printk/sysctl.c:130:35: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )( ... ) @@ got int ( * )( ... ) @@
kernel/printk/sysctl.c:130:35: sparse: expected int ( [usertype] *proc_handler )( ... )
kernel/printk/sysctl.c:130:35: sparse: got int ( * )( ... )

vim +31 kernel/printk/sysctl.c

26
27 static int printk_sysctl_deprecated(struct ctl_table *table, int write,
28 void __user *buffer, size_t *lenp,
29 loff_t *ppos)
30 {
> 31 int res = proc_dointvec(table, write, buffer, lenp, ppos);
32
33 if (write)
34 pr_warn_once(
35 "printk: The kernel.printk sysctl is deprecated. Consider using kernel.console_loglevel or kernel.default_message_loglevel instead.\n"
36 );
37
38 return res;
39 }
40
41 static int printk_console_loglevel(struct ctl_table *table, int write,
42 void __user *buffer, size_t *lenp,
43 loff_t *ppos)
44 {
45
46 struct ctl_table ltable = *table;
47 int ret, value;
48
49 if (!write)
50 return proc_dointvec(table, write, buffer, lenp, ppos);
51
52 ltable.data = &value;
53
54 ret = proc_dointvec(&ltable, write, buffer, lenp, ppos);
55 if (ret)
56 return ret;
57
58 if (value < min_loglevel || value > max_loglevel)
59 return -ERANGE;
60
61 if (value < minimum_console_loglevel)
62 return -EINVAL;
63
64 console_loglevel = value;
65
66 return 0;
67 }
68
69 static struct ctl_table printk_sysctls[] = {
70 {
71 .procname = "printk",
72 .data = &console_loglevel,
73 .maxlen = 4*sizeof(int),
74 .mode = 0644,
> 75 .proc_handler = printk_sysctl_deprecated,
76 },
77 {
78 .procname = "printk_ratelimit",
79 .data = &printk_ratelimit_state.interval,
80 .maxlen = sizeof(int),
81 .mode = 0644,
82 .proc_handler = proc_dointvec_jiffies,
83 },
84 {
85 .procname = "printk_ratelimit_burst",
86 .data = &printk_ratelimit_state.burst,
87 .maxlen = sizeof(int),
88 .mode = 0644,
89 .proc_handler = proc_dointvec,
90 },
91 {
92 .procname = "printk_delay",
93 .data = &printk_delay_msec,
94 .maxlen = sizeof(int),
95 .mode = 0644,
96 .proc_handler = proc_dointvec_minmax,
97 .extra1 = SYSCTL_ZERO,
98 .extra2 = (void *)&ten_thousand,
99 },
100 {
101 .procname = "printk_devkmsg",
102 .data = devkmsg_log_str,
103 .maxlen = DEVKMSG_STR_MAX_SIZE,
104 .mode = 0644,
105 .proc_handler = devkmsg_sysctl_set_loglvl,
106 },
107 {
108 .procname = "dmesg_restrict",
109 .data = &dmesg_restrict,
110 .maxlen = sizeof(int),
111 .mode = 0644,
112 .proc_handler = proc_dointvec_minmax_sysadmin,
113 .extra1 = SYSCTL_ZERO,
114 .extra2 = SYSCTL_ONE,
115 },
116 {
117 .procname = "kptr_restrict",
118 .data = &kptr_restrict,
119 .maxlen = sizeof(int),
120 .mode = 0644,
121 .proc_handler = proc_dointvec_minmax_sysadmin,
122 .extra1 = SYSCTL_ZERO,
123 .extra2 = SYSCTL_TWO,
124 },
125 {
126 .procname = "console_loglevel",
127 .data = &console_loglevel,
128 .maxlen = sizeof(int),
129 .mode = 0644,
130 .proc_handler = printk_console_loglevel,
131 },
132 {
133 .procname = "default_message_loglevel",
134 .data = &default_message_loglevel,
135 .maxlen = sizeof(int),
136 .mode = 0644,
137 .proc_handler = proc_dointvec_minmax,
138 .extra1 = &min_loglevel,
139 .extra2 = &max_loglevel,
140 },
141 {}
142 };
143

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-07-21 18:19    [W:0.172 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site