]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: widen action list length variables
authorDarrick J. Wong <djwong@kernel.org>
Wed, 18 May 2022 02:48:13 +0000 (22:48 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 18 May 2022 02:48:13 +0000 (22:48 -0400)
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 <djwong@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/phase4.c
scrub/repair.c
scrub/repair.h

index e78bc1e48c2fa39c8ea8be0bc0501af2c36a4c01..ecd56056ca289f90273190ee964824c073e00742 100644 (file)
@@ -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]);
index bb026101e43853b10010eb6e7881b6ead235d290..67900ea4208b4b4daed2fa6e4de4305e86d9dc7c 100644 (file)
@@ -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)
 {
index 4261be4913c4ad491c1d4ef31449bebd6a3fb9e8..102e5779c700eb7ce04f5709271ab005c38e9137 100644 (file)
@@ -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);