Skip to content

Commit 38d51b2

Browse files
biger410torvalds
authored andcommitted
ocfs2: change slot number type s16 to u16
Dan Carpenter reported the following static checker warning. fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot' fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot' fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot' That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be never negative, so change s16 to u16. Fixes: 9277f83 ("ocfs2: fix value of OCFS2_INVALID_SLOT") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Junxiao Bi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Reviewed-by: Gang He <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Jun Piao <[email protected]> Cc: <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7eba77d commit 38d51b2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

fs/ocfs2/ocfs2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ struct ocfs2_super
327327
spinlock_t osb_lock;
328328
u32 s_next_generation;
329329
unsigned long osb_flags;
330-
s16 s_inode_steal_slot;
331-
s16 s_meta_steal_slot;
330+
u16 s_inode_steal_slot;
331+
u16 s_meta_steal_slot;
332332
atomic_t s_num_inodes_stolen;
333333
atomic_t s_num_meta_stolen;
334334

fs/ocfs2/suballoc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,9 @@ static void __ocfs2_set_steal_slot(struct ocfs2_super *osb, int slot, int type)
879879
{
880880
spin_lock(&osb->osb_lock);
881881
if (type == INODE_ALLOC_SYSTEM_INODE)
882-
osb->s_inode_steal_slot = slot;
882+
osb->s_inode_steal_slot = (u16)slot;
883883
else if (type == EXTENT_ALLOC_SYSTEM_INODE)
884-
osb->s_meta_steal_slot = slot;
884+
osb->s_meta_steal_slot = (u16)slot;
885885
spin_unlock(&osb->osb_lock);
886886
}
887887

fs/ocfs2/super.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct mount_options
7878
unsigned long commit_interval;
7979
unsigned long mount_opt;
8080
unsigned int atime_quantum;
81-
signed short slot;
81+
unsigned short slot;
8282
int localalloc_opt;
8383
unsigned int resv_level;
8484
int dir_resv_level;
@@ -1349,7 +1349,7 @@ static int ocfs2_parse_options(struct super_block *sb,
13491349
goto bail;
13501350
}
13511351
if (option)
1352-
mopt->slot = (s16)option;
1352+
mopt->slot = (u16)option;
13531353
break;
13541354
case Opt_commit:
13551355
if (match_int(&args[0], &option)) {

0 commit comments

Comments
 (0)