Skip to contentSkip to conversation

xfs: calculate correct offset in xfs_scrub_quota_item

PATCH In review Eric Sandeen 2 participants 2 messages Nov 28, 2017 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: calculate correct offset in xfs_scrub_quota_item

It's only used for tracepoints so it's relatively harmless, but the offset is calculated incorrectly in xfs_scrub_quota_item.

qi_dqperchunk is the nr. of dquots per "chunk" which we have conveniently *cough* defined to always be 1 FSB. Therefore block_offset * qi_dqperchunk == first id in that chunk, and so offset = id / qi_dqperchunk

id * dqperchunk is ... meaningless.

Fixes-coverity-id: 1423965

Fixes c2fc338c ("xfs: scrub quota information")

---

compile-tested only

fs/xfs/scrub/quota.c +1 -1
index 8e58ba8..2eac160 100644
@@ -107,7 +107,7 @@
 	unsigned long long		rcount;
 	xfs_ino_t			fs_icount;
 
-	offset = id * qi->qi_dqperchunk;
+	offset = id / qi->qi_dqperchunk;
 
 	/*
 	 * We fed $id and DQNEXT into the xfs_qm_dqget call, which means
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Eric Sandeen

It's only used for tracepoints so it's relatively harmless, but the offset is calculated incorrectly in xfs_scrub_quota_item.

qi_dqperchunk is the nr. of dquots per "chunk" which we have conveniently *cough* defined to always be 1 FSB. Therefore block_offset * qi_dqperchunk == first id in that chunk, and so offset = id / qi_dqperchunk

Quoted 5 lines

id * dqperchunk is ... meaningless.

Fixes-coverity-id: 1423965

Fixes c2fc338c ("xfs: scrub quota information")

Looks ok, will test

Quoted 21 lines

---

compile-tested only

fs/xfs/scrub/quota.c +1 -2
index 8e58ba8..2eac160 100644
@@ -107,7 +107,7 @@
 	unsigned long long		rcount;
 	xfs_ino_t			fs_icount;
 
-	offset = id * qi->qi_dqperchunk;
+	offset = id / qi->qi_dqperchunk;
 
 	/*
 	 * We fed $id and DQNEXT into the xfs_qm_dqget call, which means
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html