[PATCH v2 07/22] Squashfs: fix offset in squashfs_read_inode() TRACE statements

From: Phillip Lougher

Date: Wed Nov 11 2026 - 18:58:28 EST


The offset used in the TRACE statements has been advanced past the start
of the inode header by the squashfs_read_metadata() call. This means
the offset printed is incorrect.

Fix this by using the original offset, which is obtained by calling
squashfs_inode_offset(ino).

Fixes: 6545b246a2c81 ("Squashfs: inode operations")
Signed-off-by: Phillip Lougher <phillip@xxxxxxxxxxxxxxx>
---
fs/squashfs/inode.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index bc7c81d442f2..66858fabed1a 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -184,7 +184,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)

TRACE("File inode %x:%x, start_block %llx, block_list_start "
"%llx, offset %x\n", squashfs_inode_blk(ino),
- offset, squashfs_i(inode)->start, block, offset);
+ squashfs_inode_offset(ino),
+ squashfs_i(inode)->start, block, offset);
break;
}
case SQUASHFS_LREG_TYPE: {
@@ -244,7 +245,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)

TRACE("File inode %x:%x, start_block %llx, block_list_start "
"%llx, offset %x\n", squashfs_inode_blk(ino),
- offset, squashfs_i(inode)->start, block, offset);
+ squashfs_inode_offset(ino), squashfs_i(inode)->start,
+ block, offset);
break;
}
case SQUASHFS_DIR_TYPE: {
@@ -266,7 +268,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
squashfs_i(inode)->parent = le32_to_cpu(sqsh_ino->parent_inode);

TRACE("Directory inode %x:%x, start_block %llx, offset %x\n",
- squashfs_inode_blk(ino), offset,
+ squashfs_inode_blk(ino),
+ squashfs_inode_offset(ino),
squashfs_i(inode)->start,
le16_to_cpu(sqsh_ino->offset));
break;
@@ -293,7 +296,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
squashfs_i(inode)->parent = le32_to_cpu(sqsh_ino->parent_inode);

TRACE("Long directory inode %x:%x, start_block %llx, offset "
- "%x\n", squashfs_inode_blk(ino), offset,
+ "%x\n", squashfs_inode_blk(ino),
+ squashfs_inode_offset(ino),
squashfs_i(inode)->start,
le16_to_cpu(sqsh_ino->offset));
break;
@@ -337,8 +341,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
}

TRACE("Symbolic link inode %x:%x, start_block %llx, offset "
- "%x\n", squashfs_inode_blk(ino), offset,
- block, offset);
+ "%x\n", squashfs_inode_blk(ino),
+ squashfs_inode_offset(ino), block, offset);
break;
}
case SQUASHFS_BLKDEV_TYPE:
@@ -361,7 +365,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
squashfs_i(inode)->parent = 0;

TRACE("Device inode %x:%x, rdev %x\n",
- squashfs_inode_blk(ino), offset, rdev);
+ squashfs_inode_blk(ino),
+ squashfs_inode_offset(ino), rdev);
break;
}
case SQUASHFS_LBLKDEV_TYPE:
@@ -386,7 +391,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
squashfs_i(inode)->parent = 0;

TRACE("Device inode %x:%x, rdev %x\n",
- squashfs_inode_blk(ino), offset, rdev);
+ squashfs_inode_blk(ino),
+ squashfs_inode_offset(ino), rdev);
break;
}
case SQUASHFS_FIFO_TYPE:
--
2.47.3