tree:
git://git.infradead.org/users/hch/misc.git set_fs-sysctl
head: cf76b8900dbc76c4aa0a8aa58a636c132b866604
commit: cf76b8900dbc76c4aa0a8aa58a636c132b866604 [6/6] sysctl: pass kernel pointers to
->proc_handler
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-188-g79f7ac98-dirty
git checkout cf76b8900dbc76c4aa0a8aa58a636c132b866604
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> drivers/char/random.c:2083:50: sparse: sparse: incorrect type in
argument 3 (different address spaces) @@ expected void * @@ got void [noderef]
<asvoid * @@
> drivers/char/random.c:2083:50: sparse: expected void *
> drivers/char/random.c:2083:50: sparse: got void [noderef] <asn:1> *buffer
drivers/char/random.c:2100:50: sparse: sparse: incorrect type in argument 3
(different address spaces) @@ expected void * @@ got void [noderef] <asvoid * @@
drivers/char/random.c:2100:50: sparse: expected void *
drivers/char/random.c:2100:50: sparse: got void [noderef] <asn:1> *buffer
> drivers/char/random.c:2117:35: sparse: sparse: incorrect type in
initializer (incompatible argument 3 (different address spaces)) @@ expected int (
[usertype] *proc_handler )( ... ) @@ got type] *proc_handler )( ... ) @@
> drivers/char/random.c:2117:35: sparse: expected int ( [usertype] *proc_handler )(
... )
> drivers/char/random.c:2117:35: sparse: got int ( * )( ... )
drivers/char/random.c:2141:35: sparse: sparse: incorrect type in initializer (incompatible
argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )(
... ) @@ got type] *proc_handler )( ... ) @@
drivers/char/random.c:2141:35: sparse: expected int ( [usertype] *proc_handler )(
... )
drivers/char/random.c:2141:35: sparse: got int ( * )( ... )
drivers/char/random.c:2147:35: sparse: sparse: incorrect type in initializer
(incompatible argument 3 (different address spaces)) @@ expected int ( [usertype]
*proc_handler )( ... ) @@ got type] *proc_handler )( ... ) @@
drivers/char/random.c:2147:35: sparse: expected int ( [usertype] *proc_handler )(
... )
drivers/char/random.c:2147:35: sparse: got int ( * )( ... )
drivers/char/random.c:878:12: sparse: sparse: context imbalance in
'crng_fast_load' - wrong count at exit
drivers/char/random.c:917:12: sparse: sparse: context imbalance in
'crng_slow_load' - wrong count at exit
drivers/char/random.c:1255:6: sparse: sparse: context imbalance in
'add_interrupt_randomness' - different lock contexts for basic block
vim +2083 drivers/char/random.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 2049
^1da177e4c3f41 Linus Torvalds 2005-04-16 2050 /*
f22052b2025b78 Greg Price 2013-11-29 2051 * This function is used to return both
the bootid UUID, and random
^1da177e4c3f41 Linus Torvalds 2005-04-16 2052 * UUID. The difference is in whether
table->data is NULL; if it is,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2053 * then a new UUID is generated and
returned to the user.
^1da177e4c3f41 Linus Torvalds 2005-04-16 2054 *
f22052b2025b78 Greg Price 2013-11-29 2055 * If the user accesses this via the
proc interface, the UUID will be
f22052b2025b78 Greg Price 2013-11-29 2056 * returned as an ASCII string in the
standard UUID format; if via the
f22052b2025b78 Greg Price 2013-11-29 2057 * sysctl system call, as 16 bytes of
binary data.
^1da177e4c3f41 Linus Torvalds 2005-04-16 2058 */
a151427ed08695 Joe Perches 2013-06-13 2059 static int proc_do_uuid(struct
ctl_table *table, int write,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2060 void __user *buffer, size_t *lenp,
loff_t *ppos)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2061 {
a151427ed08695 Joe Perches 2013-06-13 2062 struct ctl_table fake_table;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2063 unsigned char buf[64], tmp_uuid[16],
*uuid;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2064
^1da177e4c3f41 Linus Torvalds 2005-04-16 2065 uuid = table->data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2066 if (!uuid) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2067 uuid = tmp_uuid;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2068 generate_random_uuid(uuid);
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2069 } else {
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2070 static
DEFINE_SPINLOCK(bootid_spinlock);
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2071
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2072 spin_lock(&bootid_spinlock);
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2073 if (!uuid[8])
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2074 generate_random_uuid(uuid);
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2075 spin_unlock(&bootid_spinlock);
44e4360fa33848 Mathieu Desnoyers 2012-04-12 2076 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2077
35900771c06cee Joe Perches 2009-12-14 2078 sprintf(buf, "%pU", uuid);
35900771c06cee Joe Perches 2009-12-14 2079
^1da177e4c3f41 Linus Torvalds 2005-04-16 2080 fake_table.data = buf;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2081 fake_table.maxlen = sizeof(buf);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2082
8d65af789f3e2c Alexey Dobriyan 2009-09-23 @2083 return proc_dostring(&fake_table,
write, buffer, lenp, ppos);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2084 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2085
a283b5c459784f H. Peter Anvin 2013-09-10 2086 /*
a283b5c459784f H. Peter Anvin 2013-09-10 2087 * Return entropy available scaled to
integral bits
a283b5c459784f H. Peter Anvin 2013-09-10 2088 */
5eb10d912ea0ad Joe Perches 2014-06-06 2089 static int proc_do_entropy(struct
ctl_table *table, int write,
a283b5c459784f H. Peter Anvin 2013-09-10 2090 void __user *buffer, size_t
*lenp, loff_t *ppos)
a283b5c459784f H. Peter Anvin 2013-09-10 2091 {
5eb10d912ea0ad Joe Perches 2014-06-06 2092 struct ctl_table fake_table;
a283b5c459784f H. Peter Anvin 2013-09-10 2093 int entropy_count;
a283b5c459784f H. Peter Anvin 2013-09-10 2094
a283b5c459784f H. Peter Anvin 2013-09-10 2095 entropy_count = *(int *)table->data
>> ENTROPY_SHIFT;
a283b5c459784f H. Peter Anvin 2013-09-10 2096
a283b5c459784f H. Peter Anvin 2013-09-10 2097 fake_table.data = &entropy_count;
a283b5c459784f H. Peter Anvin 2013-09-10 2098 fake_table.maxlen =
sizeof(entropy_count);
a283b5c459784f H. Peter Anvin 2013-09-10 2099
a283b5c459784f H. Peter Anvin 2013-09-10 2100 return proc_dointvec(&fake_table,
write, buffer, lenp, ppos);
a283b5c459784f H. Peter Anvin 2013-09-10 2101 }
a283b5c459784f H. Peter Anvin 2013-09-10 2102
^1da177e4c3f41 Linus Torvalds 2005-04-16 2103 static int sysctl_poolsize =
INPUT_POOL_WORDS * 32;
a151427ed08695 Joe Perches 2013-06-13 2104 extern struct ctl_table
random_table[];
a151427ed08695 Joe Perches 2013-06-13 2105 struct ctl_table random_table[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2106 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2107 .procname = "poolsize",
^1da177e4c3f41 Linus Torvalds 2005-04-16 2108 .data = &sysctl_poolsize,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2109 .maxlen = sizeof(int),
^1da177e4c3f41 Linus Torvalds 2005-04-16 2110 .mode = 0444,
6d4561110a3e9f Eric W. Biederman 2009-11-16 2111 .proc_handler = proc_dointvec,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2112 },
^1da177e4c3f41 Linus Torvalds 2005-04-16 2113 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2114 .procname =
"entropy_avail",
^1da177e4c3f41 Linus Torvalds 2005-04-16 2115 .maxlen = sizeof(int),
^1da177e4c3f41 Linus Torvalds 2005-04-16 2116 .mode = 0444,
a283b5c459784f H. Peter Anvin 2013-09-10 @2117 .proc_handler = proc_do_entropy,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2118 .data =
&input_pool.entropy_count,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2119 },
^1da177e4c3f41 Linus Torvalds 2005-04-16 2120 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2121 .procname =
"write_wakeup_threshold",
2132a96f66b6b4 Greg Price 2013-12-06 2122 .data =
&random_write_wakeup_bits,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2123 .maxlen = sizeof(int),
^1da177e4c3f41 Linus Torvalds 2005-04-16 2124 .mode = 0644,
6d4561110a3e9f Eric W. Biederman 2009-11-16 2125 .proc_handler =
proc_dointvec_minmax,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2126 .extra1 = &min_write_thresh,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2127 .extra2 = &max_write_thresh,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2128 },
f5c2742c23886e Theodore Ts'o 2013-09-22 2129 {
f5c2742c23886e Theodore Ts'o 2013-09-22 2130 .procname =
"urandom_min_reseed_secs",
f5c2742c23886e Theodore Ts'o 2013-09-22 2131 .data =
&random_min_urandom_seed,
f5c2742c23886e Theodore Ts'o 2013-09-22 2132 .maxlen = sizeof(int),
f5c2742c23886e Theodore Ts'o 2013-09-22 2133 .mode = 0644,
f5c2742c23886e Theodore Ts'o 2013-09-22 2134 .proc_handler = proc_dointvec,
f5c2742c23886e Theodore Ts'o 2013-09-22 2135 },
^1da177e4c3f41 Linus Torvalds 2005-04-16 2136 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2137 .procname = "boot_id",
^1da177e4c3f41 Linus Torvalds 2005-04-16 2138 .data = &sysctl_bootid,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2139 .maxlen = 16,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2140 .mode = 0444,
6d4561110a3e9f Eric W. Biederman 2009-11-16 2141 .proc_handler = proc_do_uuid,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2142 },
^1da177e4c3f41 Linus Torvalds 2005-04-16 2143 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2144 .procname = "uuid",
^1da177e4c3f41 Linus Torvalds 2005-04-16 2145 .maxlen = 16,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2146 .mode = 0444,
6d4561110a3e9f Eric W. Biederman 2009-11-16 2147 .proc_handler = proc_do_uuid,
^1da177e4c3f41 Linus Torvalds 2005-04-16 2148 },
43759d4f429c8d Theodore Ts'o 2014-06-14 2149 #ifdef ADD_INTERRUPT_BENCH
43759d4f429c8d Theodore Ts'o 2014-06-14 2150 {
43759d4f429c8d Theodore Ts'o 2014-06-14 2151 .procname =
"add_interrupt_avg_cycles",
43759d4f429c8d Theodore Ts'o 2014-06-14 2152 .data = &avg_cycles,
43759d4f429c8d Theodore Ts'o 2014-06-14 2153 .maxlen = sizeof(avg_cycles),
43759d4f429c8d Theodore Ts'o 2014-06-14 2154 .mode = 0444,
43759d4f429c8d Theodore Ts'o 2014-06-14 2155 .proc_handler =
proc_doulongvec_minmax,
43759d4f429c8d Theodore Ts'o 2014-06-14 2156 },
43759d4f429c8d Theodore Ts'o 2014-06-14 2157 {
43759d4f429c8d Theodore Ts'o 2014-06-14 2158 .procname =
"add_interrupt_avg_deviation",
43759d4f429c8d Theodore Ts'o 2014-06-14 2159 .data = &avg_deviation,
43759d4f429c8d Theodore Ts'o 2014-06-14 2160 .maxlen =
sizeof(avg_deviation),
43759d4f429c8d Theodore Ts'o 2014-06-14 2161 .mode = 0444,
43759d4f429c8d Theodore Ts'o 2014-06-14 2162 .proc_handler =
proc_doulongvec_minmax,
43759d4f429c8d Theodore Ts'o 2014-06-14 2163 },
43759d4f429c8d Theodore Ts'o 2014-06-14 2164 #endif
894d2491153a9f Eric W. Biederman 2009-11-05 2165 { }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2166 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 2167 #endif /* CONFIG_SYSCTL */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2168
:::::: The code at line 2083 was first introduced by commit
:::::: 8d65af789f3e2cf4cfbdbf71a0f7a61ebcd41d38 sysctl: remove "struct file *"
argument of ->proc_handler
:::::: TO: Alexey Dobriyan <adobriyan(a)gmail.com>
:::::: CC: Linus Torvalds <torvalds(a)linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org