From 36c00a3073e1c64aa0cef472827429939e4ec998 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Fri, 15 Nov 2019 17:16:22 -0500 Subject: [PATCH] xfs: reinitialize rm_flags when unpacking an offset into an rmap irec Source kernel commit: ffb5696f7555e44c04b7c1212fcd83ddedc43498 In xfs_rmap_irec_offset_unpack, we should always clear the contents of rm_flags before we begin unpacking the encoded (ondisk) offset into the incore rm_offset and incore rm_flags fields. Remove the open-coded field zeroing as this encourages api misuse. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Eric Sandeen rm_flags = 0; irec->rm_startblock = be32_to_cpu(rec->rmap.rm_startblock); irec->rm_blockcount = be32_to_cpu(rec->rmap.rm_blockcount); irec->rm_owner = be64_to_cpu(rec->rmap.rm_owner); diff --git a/libxfs/xfs_rmap.h b/libxfs/xfs_rmap.h index 0c2c3cb73..abe633403 100644 --- a/libxfs/xfs_rmap.h +++ b/libxfs/xfs_rmap.h @@ -68,6 +68,7 @@ xfs_rmap_irec_offset_unpack( if (offset & ~(XFS_RMAP_OFF_MASK | XFS_RMAP_OFF_FLAGS)) return -EFSCORRUPTED; irec->rm_offset = XFS_RMAP_OFF(offset); + irec->rm_flags = 0; if (offset & XFS_RMAP_OFF_ATTR_FORK) irec->rm_flags |= XFS_RMAP_ATTR_FORK; if (offset & XFS_RMAP_OFF_BMBT_BLOCK) -- 2.47.2