xfsprogs/0005-xfs-fix-incorrect-test-in-xfs_alloc_ag_vextent_lastb.patch
lightmouse 24b4ee7dcb backport bugfix patches from community
Author:    wuguanghao <wuguanghao3@huawei.com>
Date:      Mon Mar 14 20:12:17 2022 +0800
(cherry picked from commit feb7ea39582af46f13599e1678473c98965b05c7)
2022-05-31 16:16:28 +08:00

37 lines
1.3 KiB
Diff

From 2c711623374764cd7f9e95da7fdf4d9e90feb4c0 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Fri, 1 May 2020 17:37:09 -0400
Subject: [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock
Source kernel commit: 77ca1eed5a7d2bf0905562eb1a15aac76bc19fe4
When I lifted the code in xfs_alloc_ag_vextent_lastblock out of a loop,
I forgot to convert all the accesses to len to be pointer dereferences.
Coverity-id: 1457918
Fixes: 5113f8ec3753ed ("xfs: clean up weird while loop in xfs_alloc_ag_vextent_near")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
libxfs/xfs_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c
index 841b0305..fee4039c 100644
--- a/libxfs/xfs_alloc.c
+++ b/libxfs/xfs_alloc.c
@@ -1510,7 +1510,7 @@ xfs_alloc_ag_vextent_lastblock(
* maxlen, go to the start of this block, and skip all those smaller
* than minlen.
*/
- if (len || args->alignment > 1) {
+ if (*len || args->alignment > 1) {
acur->cnt->bc_ptrs[0] = 1;
do {
error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
--
2.27.0