fs: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch fixes the following warnings:

fs/affs/affs.h:124:38: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/configfs/dir.c:1692:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/configfs/dir.c:1694:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ceph/file.c:249:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext4/hash.c:233:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext4/hash.c:246:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext2/inode.c:1237:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext2/inode.c:1244:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext4/indirect.c:1182:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext4/indirect.c:1188:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext4/indirect.c:1432:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ext4/indirect.c:1440:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/f2fs/node.c:618:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/f2fs/node.c:620:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/btrfs/ref-verify.c:522:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/gfs2/bmap.c:711:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/gfs2/bmap.c:722:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/jffs2/fs.c:339:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/nfsd/nfs4proc.c:429:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ufs/util.h:62:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/ufs/util.h:43:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/fcntl.c:770:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/seq_file.c:319:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/libfs.c:148:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/libfs.c:150:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/signalfd.c:178:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
fs/locks.c:1473:16: warning: this statement may fall through [-Wimplicit-fallthrough=]

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
This commit is contained in:
Gustavo A. R. Silva 2019-01-23 02:48:28 -06:00
parent 17403fa277
commit 0a4c92657f
17 changed files with 23 additions and 7 deletions

View File

@ -487,7 +487,7 @@ got_root:
break; break;
case MUFS_OFS: case MUFS_OFS:
affs_set_opt(sbi->s_flags, SF_MUFS); affs_set_opt(sbi->s_flags, SF_MUFS);
/* fall thru */ /* fall through */
case FS_OFS: case FS_OFS:
affs_set_opt(sbi->s_flags, SF_OFS); affs_set_opt(sbi->s_flags, SF_OFS);
sb->s_flags |= SB_NOEXEC; sb->s_flags |= SB_NOEXEC;
@ -495,6 +495,7 @@ got_root:
case MUFS_DCOFS: case MUFS_DCOFS:
case MUFS_INTLOFS: case MUFS_INTLOFS:
affs_set_opt(sbi->s_flags, SF_MUFS); affs_set_opt(sbi->s_flags, SF_MUFS);
/* fall through */
case FS_DCOFS: case FS_DCOFS:
case FS_INTLOFS: case FS_INTLOFS:
affs_set_opt(sbi->s_flags, SF_INTL); affs_set_opt(sbi->s_flags, SF_INTL);

View File

@ -520,6 +520,7 @@ static int process_leaf(struct btrfs_root *root,
switch (key.type) { switch (key.type) {
case BTRFS_EXTENT_ITEM_KEY: case BTRFS_EXTENT_ITEM_KEY:
*num_bytes = key.offset; *num_bytes = key.offset;
/* fall through */
case BTRFS_METADATA_ITEM_KEY: case BTRFS_METADATA_ITEM_KEY:
*bytenr = key.objectid; *bytenr = key.objectid;
ret = process_extent_item(fs_info, path, &key, i, ret = process_extent_item(fs_info, path, &key, i,

View File

@ -390,6 +390,7 @@ static inline enum btrfs_map_op btrfs_op(struct bio *bio)
return BTRFS_MAP_WRITE; return BTRFS_MAP_WRITE;
default: default:
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
/* fall through */
case REQ_OP_READ: case REQ_OP_READ:
return BTRFS_MAP_READ; return BTRFS_MAP_READ;
} }

View File

@ -247,6 +247,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
case S_IFREG: case S_IFREG:
ceph_fscache_register_inode_cookie(inode); ceph_fscache_register_inode_cookie(inode);
ceph_fscache_file_set_cookie(inode, file); ceph_fscache_file_set_cookie(inode, file);
/* fall through */
case S_IFDIR: case S_IFDIR:
ret = ceph_init_file_info(inode, file, fmode, ret = ceph_init_file_info(inode, file, fmode,
S_ISDIR(inode->i_mode)); S_ISDIR(inode->i_mode));

View File

@ -1690,9 +1690,11 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
switch (whence) { switch (whence) {
case 1: case 1:
offset += file->f_pos; offset += file->f_pos;
/* fall through */
case 0: case 0:
if (offset >= 0) if (offset >= 0)
break; break;
/* fall through */
default: default:
return -EINVAL; return -EINVAL;
} }

View File

@ -616,8 +616,10 @@ pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs)
switch (dn->max_level) { switch (dn->max_level) {
case 3: case 3:
base += 2 * indirect_blks; base += 2 * indirect_blks;
/* fall through */
case 2: case 2:
base += 2 * direct_blks; base += 2 * direct_blks;
/* fall through */
case 1: case 1:
base += direct_index; base += direct_index;
break; break;

View File

@ -769,7 +769,7 @@ static void send_sigio_to_task(struct task_struct *p,
si.si_fd = fd; si.si_fd = fd;
if (!do_send_sig_info(signum, &si, p, type)) if (!do_send_sig_info(signum, &si, p, type))
break; break;
/* fall-through: fall back on the old plain SIGIO signal */ /* fall-through - fall back on the old plain SIGIO signal */
case 0: case 0:
do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type); do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type);
} }

View File

@ -710,7 +710,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
} }
if (n == 0) if (n == 0)
break; break;
/* Branching from existing tree */ /* fall through - To branching from existing tree */
case ALLOC_GROW_DEPTH: case ALLOC_GROW_DEPTH:
if (i > 1 && i < mp->mp_fheight) if (i > 1 && i < mp->mp_fheight)
gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[i-1]); gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[i-1]);
@ -721,7 +721,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
state = ALLOC_DATA; state = ALLOC_DATA;
if (n == 0) if (n == 0)
break; break;
/* Tree complete, adding data blocks */ /* fall through - To tree complete, adding data blocks */
case ALLOC_DATA: case ALLOC_DATA:
BUG_ON(n > dblks); BUG_ON(n > dblks);
BUG_ON(mp->mp_bh[end_of_metadata] == NULL); BUG_ON(mp->mp_bh[end_of_metadata] == NULL);

View File

@ -340,6 +340,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
rdev = old_decode_dev(je16_to_cpu(jdev.old_id)); rdev = old_decode_dev(je16_to_cpu(jdev.old_id));
else else
rdev = new_decode_dev(je32_to_cpu(jdev.new_id)); rdev = new_decode_dev(je32_to_cpu(jdev.new_id));
/* fall through */
case S_IFSOCK: case S_IFSOCK:
case S_IFIFO: case S_IFIFO:

View File

@ -146,9 +146,11 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
switch (whence) { switch (whence) {
case 1: case 1:
offset += file->f_pos; offset += file->f_pos;
/* fall through */
case 0: case 0:
if (offset >= 0) if (offset >= 0)
break; break;
/* fall through */
default: default:
return -EINVAL; return -EINVAL;
} }

View File

@ -1471,7 +1471,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
switch (arg) { switch (arg) {
case F_UNLCK: case F_UNLCK:
fl->fl_flags &= ~FL_UNLOCK_PENDING; fl->fl_flags &= ~FL_UNLOCK_PENDING;
/* fall through: */ /* fall through */
case F_RDLCK: case F_RDLCK:
fl->fl_flags &= ~FL_DOWNGRADE_PENDING; fl->fl_flags &= ~FL_DOWNGRADE_PENDING;
} }

View File

@ -427,6 +427,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto out; goto out;
open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
reclaim = true; reclaim = true;
/* fall through */
case NFS4_OPEN_CLAIM_FH: case NFS4_OPEN_CLAIM_FH:
case NFS4_OPEN_CLAIM_DELEG_CUR_FH: case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
status = do_open_fhandle(rqstp, cstate, open); status = do_open_fhandle(rqstp, cstate, open);

View File

@ -2576,6 +2576,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
break; break;
default: /* checked by xdr code */ default: /* checked by xdr code */
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
/* fall through */
case SP4_SSV: case SP4_SSV:
status = nfserr_encr_alg_unsupp; status = nfserr_encr_alg_unsupp;
goto out_nolock; goto out_nolock;

View File

@ -81,6 +81,7 @@ static void o2quo_fence_self(void)
default: default:
WARN_ON(o2nm_single_cluster->cl_fence_method >= WARN_ON(o2nm_single_cluster->cl_fence_method >=
O2NM_FENCE_METHODS); O2NM_FENCE_METHODS);
/* fall through */
case O2NM_FENCE_RESET: case O2NM_FENCE_RESET:
printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this " printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this "
"system by restarting ***\n"); "system by restarting ***\n");

View File

@ -317,6 +317,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int whence)
switch (whence) { switch (whence) {
case SEEK_CUR: case SEEK_CUR:
offset += file->f_pos; offset += file->f_pos;
/* fall through */
case SEEK_SET: case SEEK_SET:
if (offset < 0) if (offset < 0)
break; break;

View File

@ -176,6 +176,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info
if (!nonblock) if (!nonblock)
break; break;
ret = -EAGAIN; ret = -EAGAIN;
/* fall through */
default: default:
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);
return ret; return ret;

View File

@ -42,7 +42,7 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
case UFS_ST_SUNOS: case UFS_ST_SUNOS:
if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state); return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
/* Fall Through to UFS_ST_SUN */ /* Fall Through - to UFS_ST_SUN */
case UFS_ST_SUN: case UFS_ST_SUN:
return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state); return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
case UFS_ST_SUNx86: case UFS_ST_SUNx86:
@ -63,7 +63,7 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value); usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
break; break;
} }
/* Fall Through to UFS_ST_SUN */ /* Fall Through - to UFS_ST_SUN */
case UFS_ST_SUN: case UFS_ST_SUN:
usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value); usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
break; break;