From: Gerard Koskamp <gerard.koskamp@nedap.com>
To: u-boot@lists.denx.de
Subject: [PATCH] fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE
Date: Fri, 30 Oct 2020 13:41:58 +0000 [thread overview]
Message-ID: <1604065318.29320.6.camel@nedap.com> (raw)
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>
CC: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
---
?fs/squashfs/sqfs_inode.c | 4 ++--
?1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c
index 14d70cf..0983974 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: {
--?
2.7.4
next reply other threads:[~2020-10-30 13:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 13:41 Gerard Koskamp [this message]
2020-10-30 17:48 ` [PATCH] fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE João Marcos Costa
2020-11-20 1:36 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1604065318.29320.6.camel@nedap.com \
--to=gerard.koskamp@nedap.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox