]> xenbits.xensource.com Git - xen.git/commitdiff
libfsimage/xfs: Remove dead code
authorAlejandro Vallejo <alejandro.vallejo@cloud.com>
Thu, 14 Sep 2023 12:22:50 +0000 (13:22 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Oct 2023 05:36:49 +0000 (06:36 +0100)
xfs_info.agnolog (and related code) and XFS_INO_AGBNO_BITS are dead code
that serve no purpose.

This is part of XSA-443 / CVE-2023-34325

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/libfsimage/xfs/fsys_xfs.c

index b8b4ca928cc5e584b4f332217cd4e99f8d822e0f..245ae9a18b3be233d6ce3d20c4a0811f680d128a 100644 (file)
@@ -38,7 +38,6 @@ struct xfs_info {
        int blklog;
        int inopblog;
        int agblklog;
-       int agnolog;
        unsigned int nextents;
        xfs_daddr_t next;
        xfs_daddr_t daddr;
@@ -66,9 +65,7 @@ static struct xfs_info xfs;
 
 #define        XFS_INO_MASK(k)         ((xfs_uint32_t)((1ULL << (k)) - 1))
 #define        XFS_INO_OFFSET_BITS     xfs.inopblog
-#define        XFS_INO_AGBNO_BITS      xfs.agblklog
 #define        XFS_INO_AGINO_BITS      (xfs.agblklog + xfs.inopblog)
-#define        XFS_INO_AGNO_BITS       xfs.agnolog
 
 static inline xfs_agblock_t
 agino2agbno (xfs_agino_t agino)
@@ -150,20 +147,6 @@ xt_len (xfs_bmbt_rec_32_t *r)
        return le32(r->l3) & mask32lo(21);
 }
 
-static inline int
-xfs_highbit32(xfs_uint32_t v)
-{
-       int i;
-
-       if (--v) {
-               for (i = 0; i < 31; i++, v >>= 1) {
-                       if (v == 0)
-                               return i;
-               }
-       }
-       return 0;
-}
-
 static int
 isinxt (xfs_fileoff_t key, xfs_fileoff_t offset, xfs_filblks_t len)
 {
@@ -470,7 +453,6 @@ xfs_mount (fsi_file_t *ffi, const char *options)
 
        xfs.inopblog = super.sb_inopblog;
        xfs.agblklog = super.sb_agblklog;
-       xfs.agnolog = xfs_highbit32 (le32(super.sb_agcount));
 
        xfs.btnode_ptr0_off =
                ((xfs.bsize - sizeof(xfs_btree_block_t)) /