[mcgrof-next:20210813-sysfs-fixes-v8 4/10] fs/kernfs/file.c:262:54: error: too many arguments provided to function-like macro invocation

From: kernel test robot
Date: Fri Aug 13 2021 - 23:37:59 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210813-sysfs-fixes-v8
head: f5b8aadeca76656caad8bccc795bfe7b0730230a
commit: 039380571a670bd61d4192cbabbfcdff60c7f630 [4/10] kernfs: add initial failure injection support
config: hexagon-randconfig-r041-20210814 (attached as .config)
compiler: clang version 12.0.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=039380571a670bd61d4192cbabbfcdff60c7f630
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210813-sysfs-fixes-v8
git checkout 039380571a670bd61d4192cbabbfcdff60c7f630
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=hexagon SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

fs/kernfs/file.c:128:15: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return NULL + !*ppos;
~~~~ ^
>> fs/kernfs/file.c:262:54: error: too many arguments provided to function-like macro invocation
if (kernfs_debug_should_wait(kernfs_fop_write_iter, at_start))
^
fs/kernfs/kernfs-internal.h:218:9: note: macro 'kernfs_debug_should_wait' defined here
#define kernfs_debug_should_wait(when) (false)
^
>> fs/kernfs/file.c:262:6: error: use of undeclared identifier 'kernfs_debug_should_wait'; did you mean 'kernfs_debug_wait'?
if (kernfs_debug_should_wait(kernfs_fop_write_iter, at_start))
^~~~~~~~~~~~~~~~~~~~~~~~
kernfs_debug_wait
fs/kernfs/kernfs-internal.h:219:20: note: 'kernfs_debug_wait' declared here
static inline void kernfs_debug_wait(void) {}
^
fs/kernfs/file.c:286:54: error: too many arguments provided to function-like macro invocation
if (kernfs_debug_should_wait(kernfs_fop_write_iter, before_mutex))
^
fs/kernfs/kernfs-internal.h:218:9: note: macro 'kernfs_debug_should_wait' defined here
#define kernfs_debug_should_wait(when) (false)
^
fs/kernfs/file.c:286:6: error: use of undeclared identifier 'kernfs_debug_should_wait'; did you mean 'kernfs_debug_wait'?
if (kernfs_debug_should_wait(kernfs_fop_write_iter, before_mutex))
^~~~~~~~~~~~~~~~~~~~~~~~
kernfs_debug_wait
fs/kernfs/kernfs-internal.h:219:20: note: 'kernfs_debug_wait' declared here
static inline void kernfs_debug_wait(void) {}
^
fs/kernfs/file.c:295:54: error: too many arguments provided to function-like macro invocation
if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_mutex))
^
fs/kernfs/kernfs-internal.h:218:9: note: macro 'kernfs_debug_should_wait' defined here
#define kernfs_debug_should_wait(when) (false)
^
fs/kernfs/file.c:295:6: error: use of undeclared identifier 'kernfs_debug_should_wait'; did you mean 'kernfs_debug_wait'?
if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_mutex))
^~~~~~~~~~~~~~~~~~~~~~~~
kernfs_debug_wait
fs/kernfs/kernfs-internal.h:219:20: note: 'kernfs_debug_wait' declared here
static inline void kernfs_debug_wait(void) {}
^
fs/kernfs/file.c:304:54: error: too many arguments provided to function-like macro invocation
if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_active))
^
fs/kernfs/kernfs-internal.h:218:9: note: macro 'kernfs_debug_should_wait' defined here
#define kernfs_debug_should_wait(when) (false)
^
fs/kernfs/file.c:304:6: error: use of undeclared identifier 'kernfs_debug_should_wait'; did you mean 'kernfs_debug_wait'?
if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_active))
^~~~~~~~~~~~~~~~~~~~~~~~
kernfs_debug_wait
fs/kernfs/kernfs-internal.h:219:20: note: 'kernfs_debug_wait' declared here
static inline void kernfs_debug_wait(void) {}
^
1 warning and 8 errors generated.


vim +262 fs/kernfs/file.c

244
245 /*
246 * Copy data in from userland and pass it to the matching kernfs write
247 * operation.
248 *
249 * There is no easy way for us to know if userspace is only doing a partial
250 * write, so we don't support them. We expect the entire buffer to come on
251 * the first write. Hint: if you're writing a value, first read the file,
252 * modify only the the value you're changing, then write entire buffer
253 * back.
254 */
255 static ssize_t kernfs_fop_write_iter(struct kiocb *iocb, struct iov_iter *iter)
256 {
257 struct kernfs_open_file *of = kernfs_of(iocb->ki_filp);
258 ssize_t len = iov_iter_count(iter);
259 const struct kernfs_ops *ops;
260 char *buf;
261
> 262 if (kernfs_debug_should_wait(kernfs_fop_write_iter, at_start))
263 kernfs_debug_wait();
264
265 if (of->atomic_write_len) {
266 if (len > of->atomic_write_len)
267 return -E2BIG;
268 } else {
269 len = min_t(size_t, len, PAGE_SIZE);
270 }
271
272 buf = of->prealloc_buf;
273 if (buf)
274 mutex_lock(&of->prealloc_mutex);
275 else
276 buf = kmalloc(len + 1, GFP_KERNEL);
277 if (!buf)
278 return -ENOMEM;
279
280 if (copy_from_iter(buf, len, iter) != len) {
281 len = -EFAULT;
282 goto out_free;
283 }
284 buf[len] = '\0'; /* guarantee string termination */
285
286 if (kernfs_debug_should_wait(kernfs_fop_write_iter, before_mutex))
287 kernfs_debug_wait();
288
289 /*
290 * @of->mutex nests outside active ref and is used both to ensure that
291 * the ops aren't called concurrently for the same open file.
292 */
293 mutex_lock(&of->mutex);
294
295 if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_mutex))
296 kernfs_debug_wait();
297
298 if (!kernfs_get_active(of->kn)) {
299 mutex_unlock(&of->mutex);
300 len = -ENODEV;
301 goto out_free;
302 }
303
304 if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_active))
305 kernfs_debug_wait();
306
307 ops = kernfs_ops(of->kn);
308 if (ops->write)
309 len = ops->write(of, buf, len, iocb->ki_pos);
310 else
311 len = -EINVAL;
312
313 kernfs_put_active(of->kn);
314 mutex_unlock(&of->mutex);
315
316 if (len > 0)
317 iocb->ki_pos += len;
318
319 out_free:
320 if (buf == of->prealloc_buf)
321 mutex_unlock(&of->prealloc_mutex);
322 else
323 kfree(buf);
324 return len;
325 }
326

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip