Skip to contentSkip to conversation

gfs2: fix quota updates on block boundaries

Cluster-devel Dan Carpenter 2 participants 2 messages Jun 4, 2015

lore
Share & tools
lore
#0 lore raw

Hello Abhi Das,

The patch 39a725803bee: "gfs2: fix quota updates on block boundaries" from Jun 2, 2015, leads to the following static checker warning:

	fs/gfs2/quota.c:801 gfs2_adjust_quota()
	warn: unsigned '()' is never less than zero.

fs/gfs2/quota.c

   798          loc -= sizeof(q); /* gfs2_internal_read would've advanced the loc ptr */
   799          err = -EIO;
   800          be64_add_cpu(&q.qu_value, change);
   801          if (be64_to_cpu(q.qu_value) < 0)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Never true.

   802                  q.qu_value = 0; /* Never go negative on quota usage */
   803          qd->qd_qb.qb_value = q.qu_value;
   804          if (fdq) {

regards,
dan carpenter

#1 lore raw

----- Original Message -----

Quoted 23 lines

From: "Dan Carpenter" <[email protected]>
To: adas at redhat.com
Cc: cluster-devel at redhat.com
Sent: Thursday, June 4, 2015 5:58:16 AM
Subject: re: gfs2: fix quota updates on block boundaries

Hello Abhi Das,

The patch 39a725803bee: "gfs2: fix quota updates on block boundaries" from Jun 2, 2015, leads to the following static checker warning:

	fs/gfs2/quota.c:801 gfs2_adjust_quota()
	warn: unsigned '()' is never less than zero.

fs/gfs2/quota.c
798 loc -= sizeof(q); /* gfs2_internal_read would've advanced the
loc ptr */

   799          err = -EIO;
   800          be64_add_cpu(&q.qu_value, change);
   801          if (be64_to_cpu(q.qu_value) < 0)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Never true.

Quoted 8 lines
   802                  q.qu_value = 0; /* Never go negative on quota usage
   */
   803          qd->qd_qb.qb_value = q.qu_value;
   804          if (fdq) {

regards,
dan carpenter

Hi Dan,

Thanks for spotting that. Looks like the if condition is missing a (s64) cast. I'll post another patch to address this.

Cheers!
--Abhi