diff options
author | Gerard Koskamp <gerard.koskamp@nedap.com> | 2020-10-30 16:41:58 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-11-19 17:45:49 +0300 |
commit | c49b0eb034710f08fc68cbfa2c23811e10667ad9 (patch) | |
tree | 052881190a2dcfec2737034c572f04ecd1ee8af0 /fs/squashfs/sqfs_inode.c | |
parent | e04072536efcbe504596ea980077eb63c52082b0 (diff) | |
download | u-boot-c49b0eb034710f08fc68cbfa2c23811e10667ad9.tar.xz |
fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE
I've created a squashfs file system with Yocto (it use squashfs-tools)
and u-boot command sqfsls give the error:'Error while searching inode:
unknown type.'
After some digging in the code I found that the index is off by 1.
This patch fix this issue and I can successful use the sqfsls command.
After search for the squashfs format I found a link talk about a
similar issue but this time in the documentation. The link is:
https://github.com/AgentD/squashfs-tools-ng/commit/e6588526838caece9529
Signed-off-by: Gerard Koskamp <gerard.koskamp@nedap.com>
Tested-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
Diffstat (limited to 'fs/squashfs/sqfs_inode.c')
-rw-r--r-- | fs/squashfs/sqfs_inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c index 14d70cf678..e76ec7cbdf 100644 --- a/fs/squashfs/sqfs_inode.c +++ b/fs/squashfs/sqfs_inode.c @@ -49,7 +49,7 @@ int sqfs_inode_size(struct squashfs_base_inode *inode, u32 blk_size) return sizeof(*ldir); di = ldir->index; - while (l < i_count + 1) { + while (l < i_count) { sz = get_unaligned_le32(&di->size) + 1; index_list_size += sz; di = (void *)di + sizeof(*di) + sz; @@ -57,7 +57,7 @@ int sqfs_inode_size(struct squashfs_base_inode *inode, u32 blk_size) } return sizeof(*ldir) + index_list_size + - (i_count + 1) * SQFS_DIR_INDEX_BASE_LENGTH; + i_count * SQFS_DIR_INDEX_BASE_LENGTH; } case SQFS_LREG_TYPE: { |