]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: ensure fiemap extents flags are compared correctly
authorPádraig Brady <P@draigBrady.com>
Sat, 23 Aug 2014 00:18:58 +0000 (01:18 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 23 Aug 2014 00:23:20 +0000 (01:23 +0100)
* src/extent-scan.c (extent_scan_read): Following on from the flags size
adjustment in commit v8.23-13-g1505b37, verify that the internal
representation of the flags is never truncated which could happen in the
unlikely case on 32 bit if the kernel flags ever expanded to 64 bits
which is theoretically possible given the reserved space.

src/extent-scan.c

index 805997a7b142abe35b400aaa4ae2f8ac4071cf4c..3af8f991deb94847ca6a018c3791c48aee99f2a8 100644 (file)
@@ -140,6 +140,8 @@ extent_scan_read (struct extent_scan *scan)
           assert (fm_extents[i].fe_logical
                   <= OFF_T_MAX - fm_extents[i].fe_length);
 
+          verify (sizeof last_ei->ext_flags >= sizeof fm_extents->fe_flags);
+
           if (si && last_ei->ext_flags
               == (fm_extents[i].fe_flags & ~FIEMAP_EXTENT_LAST)
               && (last_ei->ext_logical + last_ei->ext_length