Skip to content

Commit a484bcd

Browse files
Eric Sandeendchinner
authored andcommitted
xfs: don't overflow quota ID when initializing dqblk
Quota IDs are unsigned, and so we can pass in values up to 2^32-1. But if we try to initialize a block containing values over MAX_INT, curid will overflow and assert. curid holds a quota ID, so give it the proper xfs_dqid_t type (and remove the now-impossible ASSERT). Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent 926132c commit a484bcd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/xfs/xfs_dquot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ xfs_qm_init_dquot_blk(
232232
{
233233
struct xfs_quotainfo *q = mp->m_quotainfo;
234234
xfs_dqblk_t *d;
235-
int curid, i;
235+
xfs_dqid_t curid;
236+
int i;
236237

237238
ASSERT(tp);
238239
ASSERT(xfs_buf_islocked(bp));
@@ -243,7 +244,6 @@ xfs_qm_init_dquot_blk(
243244
* ID of the first dquot in the block - id's are zero based.
244245
*/
245246
curid = id - (id % q->qi_dqperchunk);
246-
ASSERT(curid >= 0);
247247
memset(d, 0, BBTOB(q->qi_dqchunklen));
248248
for (i = 0; i < q->qi_dqperchunk; i++, d++, curid++) {
249249
d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);

0 commit comments

Comments
 (0)