[openeuler:OLK-6.6 2464/2464] mm/mem_reliable.c:131:52: sparse: sparse: incorrect type in argument 3 (different address spaces)

tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 677789bc02303c550a9640f276fa3bf20ac18ddf commit: 200321e8a69ef82350d070de35ac4a666ab79ba6 [2464/2464] mm: mem_reliable: Add limiting the usage of reliable memory :::::: branch date: 3 hours ago :::::: commit date: 1 year, 6 months ago config: arm64-randconfig-r111-20250705 (attached as .config) compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 61529d9e36fa86782a2458e6bdeedf7f376ef4b5) reproduce: (attached as reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202507082307.SjmkbpsI-lkp@intel.com/ sparse warnings: (new ones prefixed by >>)
mm/mem_reliable.c:131:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@ mm/mem_reliable.c:131:52: sparse: expected void * mm/mem_reliable.c:131:52: sparse: got void [noderef] __user *buffer mm/mem_reliable.c:150:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@ mm/mem_reliable.c:150:52: sparse: expected void * mm/mem_reliable.c:150:52: sparse: got void [noderef] __user *buffer mm/mem_reliable.c:172:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void * @@ got void [noderef] __user *buffer @@ mm/mem_reliable.c:172:52: sparse: expected void * mm/mem_reliable.c:172:52: sparse: got void [noderef] __user *buffer mm/mem_reliable.c:190:33: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )( ... ) @@ got int ( * )( ... ) @@ mm/mem_reliable.c:190:33: sparse: expected int ( [usertype] *proc_handler )( ... ) mm/mem_reliable.c:190:33: sparse: got int ( * )( ... ) mm/mem_reliable.c:197:33: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )( ... ) @@ got int ( * )( ... ) @@ mm/mem_reliable.c:197:33: sparse: expected int ( [usertype] *proc_handler )( ... ) mm/mem_reliable.c:197:33: sparse: got int ( * )( ... ) mm/mem_reliable.c:205:33: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@ expected int ( [usertype] *proc_handler )( ... ) @@ got int ( * )( ... ) @@ mm/mem_reliable.c:205:33: sparse: expected int ( [usertype] *proc_handler )( ... ) mm/mem_reliable.c:205:33: sparse: got int ( * )( ... )
vim +131 mm/mem_reliable.c e57990640118e5 Ma Wupeng 2024-01-10 123 200321e8a69ef8 Ma Wupeng 2024-01-10 124 static int reliable_pagecache_max_bytes_write(struct ctl_table *table, 200321e8a69ef8 Ma Wupeng 2024-01-10 125 int write, void __user *buffer, 200321e8a69ef8 Ma Wupeng 2024-01-10 126 size_t *length, loff_t *ppos) 200321e8a69ef8 Ma Wupeng 2024-01-10 127 { 200321e8a69ef8 Ma Wupeng 2024-01-10 128 unsigned long old_value = pagecache_reliable_limit; 200321e8a69ef8 Ma Wupeng 2024-01-10 129 int ret; 200321e8a69ef8 Ma Wupeng 2024-01-10 130 200321e8a69ef8 Ma Wupeng 2024-01-10 @131 ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); 200321e8a69ef8 Ma Wupeng 2024-01-10 132 if (!ret && write) { 200321e8a69ef8 Ma Wupeng 2024-01-10 133 if (pagecache_reliable_limit > 200321e8a69ef8 Ma Wupeng 2024-01-10 134 PAGES_TO_B(total_reliable_pages())) { 200321e8a69ef8 Ma Wupeng 2024-01-10 135 pagecache_reliable_limit = old_value; 200321e8a69ef8 Ma Wupeng 2024-01-10 136 return -EINVAL; 200321e8a69ef8 Ma Wupeng 2024-01-10 137 } 200321e8a69ef8 Ma Wupeng 2024-01-10 138 } 200321e8a69ef8 Ma Wupeng 2024-01-10 139 200321e8a69ef8 Ma Wupeng 2024-01-10 140 return ret; 200321e8a69ef8 Ma Wupeng 2024-01-10 141 } 200321e8a69ef8 Ma Wupeng 2024-01-10 142 200321e8a69ef8 Ma Wupeng 2024-01-10 143 static int reliable_limit_handler(struct ctl_table *table, int write, 200321e8a69ef8 Ma Wupeng 2024-01-10 144 void __user *buffer, size_t *length, 200321e8a69ef8 Ma Wupeng 2024-01-10 145 loff_t *ppos) 200321e8a69ef8 Ma Wupeng 2024-01-10 146 { 200321e8a69ef8 Ma Wupeng 2024-01-10 147 unsigned long old = task_reliable_limit; 200321e8a69ef8 Ma Wupeng 2024-01-10 148 int ret; 200321e8a69ef8 Ma Wupeng 2024-01-10 149 200321e8a69ef8 Ma Wupeng 2024-01-10 150 ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); 200321e8a69ef8 Ma Wupeng 2024-01-10 151 if (!ret && write) { 200321e8a69ef8 Ma Wupeng 2024-01-10 152 if (task_reliable_limit > PAGES_TO_B(total_reliable_pages()) || 200321e8a69ef8 Ma Wupeng 2024-01-10 153 task_reliable_limit < 200321e8a69ef8 Ma Wupeng 2024-01-10 154 (task_reliable_used_pages() << PAGE_SHIFT)) { 200321e8a69ef8 Ma Wupeng 2024-01-10 155 task_reliable_limit = old; 200321e8a69ef8 Ma Wupeng 2024-01-10 156 return -EINVAL; 200321e8a69ef8 Ma Wupeng 2024-01-10 157 } 200321e8a69ef8 Ma Wupeng 2024-01-10 158 } 200321e8a69ef8 Ma Wupeng 2024-01-10 159 200321e8a69ef8 Ma Wupeng 2024-01-10 160 return ret; 200321e8a69ef8 Ma Wupeng 2024-01-10 161 } 200321e8a69ef8 Ma Wupeng 2024-01-10 162 200321e8a69ef8 Ma Wupeng 2024-01-10 163 #ifdef CONFIG_SHMEM 200321e8a69ef8 Ma Wupeng 2024-01-10 164 static int reliable_shmem_bytes_limit_handler(struct ctl_table *table, 200321e8a69ef8 Ma Wupeng 2024-01-10 165 int write, void __user *buffer, 200321e8a69ef8 Ma Wupeng 2024-01-10 166 size_t *length, loff_t *ppos) 200321e8a69ef8 Ma Wupeng 2024-01-10 167 { 200321e8a69ef8 Ma Wupeng 2024-01-10 168 unsigned long *data_ptr = (unsigned long *)(table->data); 200321e8a69ef8 Ma Wupeng 2024-01-10 169 unsigned long old = *data_ptr; 200321e8a69ef8 Ma Wupeng 2024-01-10 170 int ret; 200321e8a69ef8 Ma Wupeng 2024-01-10 171 200321e8a69ef8 Ma Wupeng 2024-01-10 172 ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); 200321e8a69ef8 Ma Wupeng 2024-01-10 173 if (!ret && write) { 200321e8a69ef8 Ma Wupeng 2024-01-10 174 if (*data_ptr > PAGES_TO_B(total_reliable_pages())) { 200321e8a69ef8 Ma Wupeng 2024-01-10 175 *data_ptr = old; 200321e8a69ef8 Ma Wupeng 2024-01-10 176 return -EINVAL; 200321e8a69ef8 Ma Wupeng 2024-01-10 177 } 200321e8a69ef8 Ma Wupeng 2024-01-10 178 } 200321e8a69ef8 Ma Wupeng 2024-01-10 179 200321e8a69ef8 Ma Wupeng 2024-01-10 180 return ret; 200321e8a69ef8 Ma Wupeng 2024-01-10 181 } 200321e8a69ef8 Ma Wupeng 2024-01-10 182 #endif 200321e8a69ef8 Ma Wupeng 2024-01-10 183 200321e8a69ef8 Ma Wupeng 2024-01-10 184 static struct ctl_table reliable_ctl_table[] = { 200321e8a69ef8 Ma Wupeng 2024-01-10 185 { 200321e8a69ef8 Ma Wupeng 2024-01-10 186 .procname = "reliable_pagecache_max_bytes", 200321e8a69ef8 Ma Wupeng 2024-01-10 187 .data = &pagecache_reliable_limit, 200321e8a69ef8 Ma Wupeng 2024-01-10 188 .maxlen = sizeof(pagecache_reliable_limit), 200321e8a69ef8 Ma Wupeng 2024-01-10 189 .mode = 0644, 200321e8a69ef8 Ma Wupeng 2024-01-10 @190 .proc_handler = reliable_pagecache_max_bytes_write, 200321e8a69ef8 Ma Wupeng 2024-01-10 191 }, 200321e8a69ef8 Ma Wupeng 2024-01-10 192 { 200321e8a69ef8 Ma Wupeng 2024-01-10 193 .procname = "task_reliable_limit", 200321e8a69ef8 Ma Wupeng 2024-01-10 194 .data = &task_reliable_limit, 200321e8a69ef8 Ma Wupeng 2024-01-10 195 .maxlen = sizeof(task_reliable_limit), 200321e8a69ef8 Ma Wupeng 2024-01-10 196 .mode = 0644, 200321e8a69ef8 Ma Wupeng 2024-01-10 197 .proc_handler = reliable_limit_handler, 200321e8a69ef8 Ma Wupeng 2024-01-10 198 }, 200321e8a69ef8 Ma Wupeng 2024-01-10 199 #ifdef CONFIG_SHMEM 200321e8a69ef8 Ma Wupeng 2024-01-10 200 { 200321e8a69ef8 Ma Wupeng 2024-01-10 201 .procname = "shmem_reliable_bytes_limit", 200321e8a69ef8 Ma Wupeng 2024-01-10 202 .data = &shmem_reliable_limit, 200321e8a69ef8 Ma Wupeng 2024-01-10 203 .maxlen = sizeof(shmem_reliable_limit), 200321e8a69ef8 Ma Wupeng 2024-01-10 204 .mode = 0644, 200321e8a69ef8 Ma Wupeng 2024-01-10 205 .proc_handler = reliable_shmem_bytes_limit_handler, 200321e8a69ef8 Ma Wupeng 2024-01-10 206 }, 200321e8a69ef8 Ma Wupeng 2024-01-10 207 #endif 200321e8a69ef8 Ma Wupeng 2024-01-10 208 {} 200321e8a69ef8 Ma Wupeng 2024-01-10 209 }; 200321e8a69ef8 Ma Wupeng 2024-01-10 210 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
participants (1)
-
kernel test robot