Commit 46d36880 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: simplify checking quota limits in ext4_statfs()

Coverity reports that conditions checking quota limits in ext4_statfs()
contain dead code. Indeed it is right and current conditions can be
simplified.

Link: https://lore.kernel.org/r/20200130111148.10766-1-jack@suse.czReported-by: default avatarCoverity <scan-admin@coverity.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
parent 14c9ca05
...@@ -5585,10 +5585,7 @@ static int ext4_statfs_project(struct super_block *sb, ...@@ -5585,10 +5585,7 @@ static int ext4_statfs_project(struct super_block *sb,
return PTR_ERR(dquot); return PTR_ERR(dquot);
spin_lock(&dquot->dq_dqb_lock); spin_lock(&dquot->dq_dqb_lock);
limit = 0; limit = dquot->dq_dqb.dqb_bsoftlimit;
if (dquot->dq_dqb.dqb_bsoftlimit &&
(!limit || dquot->dq_dqb.dqb_bsoftlimit < limit))
limit = dquot->dq_dqb.dqb_bsoftlimit;
if (dquot->dq_dqb.dqb_bhardlimit && if (dquot->dq_dqb.dqb_bhardlimit &&
(!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) (!limit || dquot->dq_dqb.dqb_bhardlimit < limit))
limit = dquot->dq_dqb.dqb_bhardlimit; limit = dquot->dq_dqb.dqb_bhardlimit;
...@@ -5603,10 +5600,7 @@ static int ext4_statfs_project(struct super_block *sb, ...@@ -5603,10 +5600,7 @@ static int ext4_statfs_project(struct super_block *sb,
(buf->f_blocks - curblock) : 0; (buf->f_blocks - curblock) : 0;
} }
limit = 0; limit = dquot->dq_dqb.dqb_isoftlimit;
if (dquot->dq_dqb.dqb_isoftlimit &&
(!limit || dquot->dq_dqb.dqb_isoftlimit < limit))
limit = dquot->dq_dqb.dqb_isoftlimit;
if (dquot->dq_dqb.dqb_ihardlimit && if (dquot->dq_dqb.dqb_ihardlimit &&
(!limit || dquot->dq_dqb.dqb_ihardlimit < limit)) (!limit || dquot->dq_dqb.dqb_ihardlimit < limit))
limit = dquot->dq_dqb.dqb_ihardlimit; limit = dquot->dq_dqb.dqb_ihardlimit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment