From 0e5dce33d7a1c9d4e5d90126cc4cb217253cae8d Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 17 May 2022 22:48:13 -0400 Subject: [PATCH] xfs_scrub: widen action list length variables On a 32-bit system it's possible for there to be so many items in the repair list that we overflow a size_t. Widen this to unsigned long long. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- scrub/phase4.c | 6 +++--- scrub/repair.c | 2 +- scrub/repair.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scrub/phase4.c b/scrub/phase4.c index e78bc1e48..ecd56056c 100644 --- a/scrub/phase4.c +++ b/scrub/phase4.c @@ -30,8 +30,8 @@ repair_ag( struct scrub_ctx *ctx = (struct scrub_ctx *)wq->wq_ctx; bool *aborted = priv; struct action_list *alist; - size_t unfixed; - size_t new_unfixed; + unsigned long long unfixed; + unsigned long long new_unfixed; unsigned int flags = 0; int ret; @@ -168,7 +168,7 @@ phase4_estimate( int *rshift) { xfs_agnumber_t agno; - size_t need_fixing = 0; + unsigned long long need_fixing = 0; for (agno = 0; agno < ctx->mnt.fsgeom.agcount; agno++) need_fixing += action_list_length(&ctx->action_lists[agno]); diff --git a/scrub/repair.c b/scrub/repair.c index bb026101e..67900ea42 100644 --- a/scrub/repair.c +++ b/scrub/repair.c @@ -189,7 +189,7 @@ action_list_init( } /* Number of repairs in this list. */ -size_t +unsigned long long action_list_length( struct action_list *alist) { diff --git a/scrub/repair.h b/scrub/repair.h index 4261be491..102e5779c 100644 --- a/scrub/repair.h +++ b/scrub/repair.h @@ -8,7 +8,7 @@ struct action_list { struct list_head list; - size_t nr; + unsigned long long nr; bool sorted; }; @@ -22,7 +22,7 @@ static inline bool action_list_empty(const struct action_list *alist) return list_empty(&alist->list); } -size_t action_list_length(struct action_list *alist); +unsigned long long action_list_length(struct action_list *alist); void action_list_add(struct action_list *dest, struct action_item *item); void action_list_splice(struct action_list *dest, struct action_list *src); -- 2.47.2