]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: reinitialize rm_flags when unpacking an offset into an rmap irec
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 13 Dec 2019 00:54:33 +0000 (19:54 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 13 Dec 2019 00:54:33 +0000 (19:54 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index d9b19c6718319b8db2f620ecf3ec9ae29499a56f..34739ff2ff19d48023d993eaf8e265924565a780 100644 (file)
@@ -166,7 +166,6 @@ xfs_rmap_btrec_to_irec(
        union xfs_btree_rec     *rec,
        struct xfs_rmap_irec    *irec)
 {
-       irec->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);
index 0c2c3cb73429a3fd2df697e3f2f2a56ba39cd788..abe633403fd152db0eecb4d31e25caaa5c5dd020 100644 (file)
@@ -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)