[gustavoars-linux:for-next/kspp 5/5] fs/fcntl.c:373:3: warning: fallthrough annotation in unreachable code

From: kernel test robot
Date: Mon Jul 12 2021 - 06:33:04 EST


Hi Gustavo,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/kspp
head: cd013b8a781567829cbb0764958b640642edc6ff
commit: cd013b8a781567829cbb0764958b640642edc6ff [5/5] Makefile: Enable -Wimplicit-fallthrough for Clang
config: riscv-buildonly-randconfig-r003-20210712 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=cd013b8a781567829cbb0764958b640642edc6ff
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/kspp
git checkout cd013b8a781567829cbb0764958b640642edc6ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

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

All warnings (new ones prefixed by >>):

>> fs/fcntl.c:373:3: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
1 warning generated.
--
>> kernel/sched/core.c:3141:4: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
kernel/sched/core.c:3204:6: warning: no previous prototype for function 'sched_set_stop_task' [-Wmissing-prototypes]
void sched_set_stop_task(int cpu, struct task_struct *stop)
^
kernel/sched/core.c:3204:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void sched_set_stop_task(int cpu, struct task_struct *stop)
^
static
2 warnings generated.
--
>> drivers/mtd/chips/cfi_util.c:112:3: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
drivers/mtd/chips/cfi_util.c:168:3: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
2 warnings generated.
--
>> sound/core/pcm_native.c:3799:3: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
sound/core/pcm_native.c:3807:3: warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]
fallthrough;
^
include/linux/compiler_attributes.h:210:41: note: expanded from macro 'fallthrough'
# define fallthrough __attribute__((__fallthrough__))
^
2 warnings generated.


vim +373 fs/fcntl.c

c75b1d9421f80f Jens Axboe 2017-06-27 329
^1da177e4c3f41 Linus Torvalds 2005-04-16 330 static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
^1da177e4c3f41 Linus Torvalds 2005-04-16 331 struct file *filp)
^1da177e4c3f41 Linus Torvalds 2005-04-16 332 {
a75d30c7720785 Christoph Hellwig 2017-05-27 333 void __user *argp = (void __user *)arg;
a75d30c7720785 Christoph Hellwig 2017-05-27 334 struct flock flock;
^1da177e4c3f41 Linus Torvalds 2005-04-16 335 long err = -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 336
^1da177e4c3f41 Linus Torvalds 2005-04-16 337 switch (cmd) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 338 case F_DUPFD:
fe17f22d7fd0e3 Al Viro 2012-08-21 339 err = f_dupfd(arg, filp, 0);
4e1e018ecc6f7b Al Viro 2008-07-26 340 break;
fe17f22d7fd0e3 Al Viro 2012-08-21 341 case F_DUPFD_CLOEXEC:
121977187ca0a7 Al Viro 2012-10-08 342 err = f_dupfd(arg, filp, O_CLOEXEC);
^1da177e4c3f41 Linus Torvalds 2005-04-16 343 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 344 case F_GETFD:
^1da177e4c3f41 Linus Torvalds 2005-04-16 345 err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 346 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 347 case F_SETFD:
^1da177e4c3f41 Linus Torvalds 2005-04-16 348 err = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 349 set_close_on_exec(fd, arg & FD_CLOEXEC);
^1da177e4c3f41 Linus Torvalds 2005-04-16 350 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 351 case F_GETFL:
^1da177e4c3f41 Linus Torvalds 2005-04-16 352 err = filp->f_flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 353 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 354 case F_SETFL:
^1da177e4c3f41 Linus Torvalds 2005-04-16 355 err = setfl(fd, filp, arg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 356 break;
5d50ffd7c31dab Jeff Layton 2014-02-03 357 #if BITS_PER_LONG != 32
5d50ffd7c31dab Jeff Layton 2014-02-03 358 /* 32-bit arches must use fcntl64() */
0d3f7a2dd2f5cf Jeff Layton 2014-04-22 359 case F_OFD_GETLK:
5d50ffd7c31dab Jeff Layton 2014-02-03 360 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 361 case F_GETLK:
a75d30c7720785 Christoph Hellwig 2017-05-27 362 if (copy_from_user(&flock, argp, sizeof(flock)))
a75d30c7720785 Christoph Hellwig 2017-05-27 363 return -EFAULT;
a75d30c7720785 Christoph Hellwig 2017-05-27 364 err = fcntl_getlk(filp, cmd, &flock);
a75d30c7720785 Christoph Hellwig 2017-05-27 365 if (!err && copy_to_user(argp, &flock, sizeof(flock)))
a75d30c7720785 Christoph Hellwig 2017-05-27 366 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 367 break;
5d50ffd7c31dab Jeff Layton 2014-02-03 368 #if BITS_PER_LONG != 32
5d50ffd7c31dab Jeff Layton 2014-02-03 369 /* 32-bit arches must use fcntl64() */
0d3f7a2dd2f5cf Jeff Layton 2014-04-22 370 case F_OFD_SETLK:
0d3f7a2dd2f5cf Jeff Layton 2014-04-22 371 case F_OFD_SETLKW:
5d50ffd7c31dab Jeff Layton 2014-02-03 372 #endif
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 @373 fallthrough;
^1da177e4c3f41 Linus Torvalds 2005-04-16 374 case F_SETLK:
^1da177e4c3f41 Linus Torvalds 2005-04-16 375 case F_SETLKW:
a75d30c7720785 Christoph Hellwig 2017-05-27 376 if (copy_from_user(&flock, argp, sizeof(flock)))
a75d30c7720785 Christoph Hellwig 2017-05-27 377 return -EFAULT;
a75d30c7720785 Christoph Hellwig 2017-05-27 378 err = fcntl_setlk(fd, filp, cmd, &flock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 379 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 380 case F_GETOWN:
^1da177e4c3f41 Linus Torvalds 2005-04-16 381 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 382 * XXX If f_owner is a process group, the
^1da177e4c3f41 Linus Torvalds 2005-04-16 383 * negative return value will get converted
^1da177e4c3f41 Linus Torvalds 2005-04-16 384 * into an error. Oops. If we keep the
^1da177e4c3f41 Linus Torvalds 2005-04-16 385 * current syscall conventions, the only way
^1da177e4c3f41 Linus Torvalds 2005-04-16 386 * to fix this will be in libc.
^1da177e4c3f41 Linus Torvalds 2005-04-16 387 */
609d7fa9565c75 Eric W. Biederman 2006-10-02 388 err = f_getown(filp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 389 force_successful_syscall_return();
^1da177e4c3f41 Linus Torvalds 2005-04-16 390 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 391 case F_SETOWN:
393cc3f51135ea Jiri Slaby 2017-06-13 392 err = f_setown(filp, arg, 1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 393 break;
ba0a6c9f6fceed Peter Zijlstra 2009-09-23 394 case F_GETOWN_EX:
ba0a6c9f6fceed Peter Zijlstra 2009-09-23 395 err = f_getown_ex(filp, arg);
ba0a6c9f6fceed Peter Zijlstra 2009-09-23 396 break;
ba0a6c9f6fceed Peter Zijlstra 2009-09-23 397 case F_SETOWN_EX:
ba0a6c9f6fceed Peter Zijlstra 2009-09-23 398 err = f_setown_ex(filp, arg);
ba0a6c9f6fceed Peter Zijlstra 2009-09-23 399 break;
1d151c337d79fa Cyrill Gorcunov 2012-07-30 400 case F_GETOWNER_UIDS:
1d151c337d79fa Cyrill Gorcunov 2012-07-30 401 err = f_getowner_uids(filp, arg);
1d151c337d79fa Cyrill Gorcunov 2012-07-30 402 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 403 case F_GETSIG:
^1da177e4c3f41 Linus Torvalds 2005-04-16 404 err = filp->f_owner.signum;
^1da177e4c3f41 Linus Torvalds 2005-04-16 405 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 406 case F_SETSIG:
^1da177e4c3f41 Linus Torvalds 2005-04-16 407 /* arg == 0 restores default behaviour. */
7ed20e1ad521b5 Jesper Juhl 2005-05-01 408 if (!valid_signal(arg)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 409 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 410 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 411 err = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 412 filp->f_owner.signum = arg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 413 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 414 case F_GETLEASE:
^1da177e4c3f41 Linus Torvalds 2005-04-16 415 err = fcntl_getlease(filp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 416 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 417 case F_SETLEASE:
^1da177e4c3f41 Linus Torvalds 2005-04-16 418 err = fcntl_setlease(fd, filp, arg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 419 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 420 case F_NOTIFY:
^1da177e4c3f41 Linus Torvalds 2005-04-16 421 err = fcntl_dirnotify(fd, filp, arg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 422 break;
35f3d14dbbc584 Jens Axboe 2010-05-20 423 case F_SETPIPE_SZ:
35f3d14dbbc584 Jens Axboe 2010-05-20 424 case F_GETPIPE_SZ:
35f3d14dbbc584 Jens Axboe 2010-05-20 425 err = pipe_fcntl(filp, cmd, arg);
35f3d14dbbc584 Jens Axboe 2010-05-20 426 break;
40e041a2c858b3 David Herrmann 2014-08-08 427 case F_ADD_SEALS:
40e041a2c858b3 David Herrmann 2014-08-08 428 case F_GET_SEALS:
5aadc431a593ac Marc-André Lureau 2018-01-31 429 err = memfd_fcntl(filp, cmd, arg);
40e041a2c858b3 David Herrmann 2014-08-08 430 break;
c75b1d9421f80f Jens Axboe 2017-06-27 431 case F_GET_RW_HINT:
c75b1d9421f80f Jens Axboe 2017-06-27 432 case F_SET_RW_HINT:
c75b1d9421f80f Jens Axboe 2017-06-27 433 case F_GET_FILE_RW_HINT:
c75b1d9421f80f Jens Axboe 2017-06-27 434 case F_SET_FILE_RW_HINT:
c75b1d9421f80f Jens Axboe 2017-06-27 435 err = fcntl_rw_hint(filp, cmd, arg);
c75b1d9421f80f Jens Axboe 2017-06-27 436 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 437 default:
^1da177e4c3f41 Linus Torvalds 2005-04-16 438 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 439 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 440 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 441 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 442

:::::: The code at line 373 was first introduced by commit
:::::: df561f6688fef775baa341a0f5d960becd248b11 treewide: Use fallthrough pseudo-keyword

:::::: TO: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
:::::: CC: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip