]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
fs: mark expected switch fall-throughs
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 23 Jan 2019 08:48:28 +0000 (02:48 -0600)
committerGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 8 Apr 2019 23:21:02 +0000 (18:21 -0500)
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>
17 files changed:
fs/affs/super.c
fs/btrfs/ref-verify.c
fs/btrfs/volumes.h
fs/ceph/file.c
fs/configfs/dir.c
fs/f2fs/node.c
fs/fcntl.c
fs/gfs2/bmap.c
fs/jffs2/fs.c
fs/libfs.c
fs/locks.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4state.c
fs/ocfs2/cluster/quorum.c
fs/seq_file.c
fs/signalfd.c
fs/ufs/util.h

index d1ad11a8a4a59c2d7de3e854cfeb8b28716be59d..3accc6daec689d1f871d61489691f3fe0e14ab23 100644 (file)
@@ -487,7 +487,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
                break;
        case MUFS_OFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall thru */
+               /* fall through */
        case FS_OFS:
                affs_set_opt(sbi->s_flags, SF_OFS);
                sb->s_flags |= SB_NOEXEC;
@@ -495,6 +495,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
        case MUFS_DCOFS:
        case MUFS_INTLOFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
+               /* fall through */
        case FS_DCOFS:
        case FS_INTLOFS:
                affs_set_opt(sbi->s_flags, SF_INTL);
index d09b6cdb785a0a979a91d471e34844549d102df5..b7c8e016910673ace0f8dca5966102c4d63b42d2 100644 (file)
@@ -520,6 +520,7 @@ static int process_leaf(struct btrfs_root *root,
                switch (key.type) {
                case BTRFS_EXTENT_ITEM_KEY:
                        *num_bytes = key.offset;
+                       /* fall through */
                case BTRFS_METADATA_ITEM_KEY:
                        *bytenr = key.objectid;
                        ret = process_extent_item(fs_info, path, &key, i,
index 3ad9d58d1b6618aea5d79220e48fdf98ac243360..adcbb4e7b1a03df26578eab4533e408f27780179 100644 (file)
@@ -390,6 +390,7 @@ static inline enum btrfs_map_op btrfs_op(struct bio *bio)
                return BTRFS_MAP_WRITE;
        default:
                WARN_ON_ONCE(1);
+               /* fall through */
        case REQ_OP_READ:
                return BTRFS_MAP_READ;
        }
index 9f53c3d993040b1061da660bee2492c9d32a940f..84725b53ac2190e423c3233aaac7d9adc2a745f4 100644 (file)
@@ -247,6 +247,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
        case S_IFREG:
                ceph_fscache_register_inode_cookie(inode);
                ceph_fscache_file_set_cookie(inode, file);
+               /* fall through */
        case S_IFDIR:
                ret = ceph_init_file_info(inode, file, fmode,
                                                S_ISDIR(inode->i_mode));
index 39843fa7e11b07353cd23d36b4ab973fb4a924b7..591e82ba443cd36bae59cb621acd2fad178d23ac 100644 (file)
@@ -1690,9 +1690,11 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
                case 1:
                        offset += file->f_pos;
+                       /* fall through */
                case 0:
                        if (offset >= 0)
                                break;
+                       /* fall through */
                default:
                        return -EINVAL;
        }
index 3f99ab2886955dd74467ea3d1ac00daeba046f5e..d6e48a6487d511fa08c9bd99906106fcc86540b8 100644 (file)
@@ -616,8 +616,10 @@ pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs)
        switch (dn->max_level) {
        case 3:
                base += 2 * indirect_blks;
+               /* fall through */
        case 2:
                base += 2 * direct_blks;
+               /* fall through */
        case 1:
                base += direct_index;
                break;
index 083185174c6d1452db686b01c877dc53ff8466e6..3d40771e8e7cf59da14f617c9df473c1a7adeb6e 100644 (file)
@@ -769,7 +769,7 @@ static void send_sigio_to_task(struct task_struct *p,
                        si.si_fd    = fd;
                        if (!do_send_sig_info(signum, &si, p, type))
                                break;
-               /* fall-through: fall back on the old plain SIGIO signal */
+               /* fall-through - fall back on the old plain SIGIO signal */
                case 0:
                        do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type);
        }
index 02b2646d84b3a38d967a6811b35e911aab658681..fc95fe528c4789253c8862801ae9c930d2a26bca 100644 (file)
@@ -710,7 +710,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
                        }
                        if (n == 0)
                                break;
-               /* Branching from existing tree */
+               /* fall through - To branching from existing tree */
                case ALLOC_GROW_DEPTH:
                        if (i > 1 && i < mp->mp_fheight)
                                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;
                        if (n == 0)
                                break;
-               /* Tree complete, adding data blocks */
+               /* fall through - To tree complete, adding data blocks */
                case ALLOC_DATA:
                        BUG_ON(n > dblks);
                        BUG_ON(mp->mp_bh[end_of_metadata] == NULL);
index eab04eca95a3f6accd533be6b0c36fe7a92c75f1..112d85849db1046538844009f35402090f02eebe 100644 (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));
                else
                        rdev = new_decode_dev(je32_to_cpu(jdev.new_id));
+               /* fall through */
 
        case S_IFSOCK:
        case S_IFIFO:
index 0fb590d79f30ed78d0626fd79f24cacf9e1a72b8..9efb647917e0222db97c710fdc50f873ef5e4150 100644 (file)
@@ -146,9 +146,11 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
                case 1:
                        offset += file->f_pos;
+                       /* fall through */
                case 0:
                        if (offset >= 0)
                                break;
+                       /* fall through */
                default:
                        return -EINVAL;
        }
index eaa1cfaf73b08c8fda256ea57ab816dcc4985217..737166f3cf14cb63958699c67653295a1972009a 100644 (file)
@@ -1471,7 +1471,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
        switch (arg) {
        case F_UNLCK:
                fl->fl_flags &= ~FL_UNLOCK_PENDING;
-               /* fall through: */
+               /* fall through */
        case F_RDLCK:
                fl->fl_flags &= ~FL_DOWNGRADE_PENDING;
        }
index 0cfd257ffdaf09747664361322c3d13da73f29e7..4680ad3bf55b27108aa9d11a33fb73d02239b4ba 100644 (file)
@@ -427,6 +427,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                                goto out;
                        open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
                        reclaim = true;
+                       /* fall through */
                case NFS4_OPEN_CLAIM_FH:
                case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
                        status = do_open_fhandle(rqstp, cstate, open);
index 6a45fb00c5fcdccabdb142096270aa6035fe2f32..0742aa44a75667485d8c25170b13ae3f1224b472 100644 (file)
@@ -2576,6 +2576,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                break;
        default:                                /* checked by xdr code */
                WARN_ON_ONCE(1);
+               /* fall through */
        case SP4_SSV:
                status = nfserr_encr_alg_unsupp;
                goto out_nolock;
index af2e7473956e8f7f956fdad517634c6b4e18f14c..67dcee65fe5063b77758f8db2994ad4f9015564e 100644 (file)
@@ -81,6 +81,7 @@ static void o2quo_fence_self(void)
        default:
                WARN_ON(o2nm_single_cluster->cl_fence_method >=
                        O2NM_FENCE_METHODS);
+               /* fall through */
        case O2NM_FENCE_RESET:
                printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this "
                       "system by restarting ***\n");
index 1dea7a8a52550e234ce3c05565ad8cfa56eeb1f2..abe27ec431766f9ae05cd0b87c6acf3f680f2981 100644 (file)
@@ -317,6 +317,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
        case SEEK_CUR:
                offset += file->f_pos;
+               /* fall through */
        case SEEK_SET:
                if (offset < 0)
                        break;
index 757afc7c5895bb4472d4ee7d613ce4148f573fb7..44b6845b071c3321872cfce6d1cf3c672077480f 100644 (file)
@@ -176,6 +176,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info
                if (!nonblock)
                        break;
                ret = -EAGAIN;
+               /* fall through */
        default:
                spin_unlock_irq(&current->sighand->siglock);
                return ret;
index 1fd3011ea6236b6f0bcb04bd52051c0ffd930cda..f1ce2897542901b2241dbd38f4d347d7a63099db 100644 (file)
@@ -42,7 +42,7 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
        case UFS_ST_SUNOS:
                if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
                        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:
                return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
        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);
                        break;
                }
-               /* Fall Through to UFS_ST_SUN */
+               /* Fall Through to UFS_ST_SUN */
        case UFS_ST_SUN:
                usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
                break;