Skip to content

Commit 1bdf453

Browse files
Abhi DasAstralBob
authored andcommitted
gfs2: s64 cast for negative quota value
One-line fix to cast quota value to s64 before comparison. By default the quantity is treated as u64. Signed-off-by: Abhi Das <[email protected]> Signed-off-by: Bob Peterson <[email protected]> Acked-by: Steven Whitehouse <[email protected]>
1 parent 9cde289 commit 1bdf453

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/gfs2/quota.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
798798
loc -= sizeof(q); /* gfs2_internal_read would've advanced the loc ptr */
799799
err = -EIO;
800800
be64_add_cpu(&q.qu_value, change);
801-
if (be64_to_cpu(q.qu_value) < 0)
801+
if (((s64)be64_to_cpu(q.qu_value)) < 0)
802802
q.qu_value = 0; /* Never go negative on quota usage */
803803
qd->qd_qb.qb_value = q.qu_value;
804804
if (fdq) {

0 commit comments

Comments
 (0)