From: Frederic Germain <frederic.germain@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Frederic Germain <frederic.germain@gmail.com>
Subject: [PATCH 4/4] find_raw_inode returns latest version with data of inode
Date: Tue, 9 Nov 2021 08:17:51 +0000 [thread overview]
Message-ID: <20211109081751.480718-5-frederic.germain@gmail.com> (raw)
In-Reply-To: <20211109081751.480718-1-frederic.germain@gmail.com>
Signed-off-by: Frederic Germain <frederic.germain@gmail.com>
---
jffsX-utils/jffs2reader.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c
index 2aa2137..c0c61cf 100644
--- a/jffsX-utils/jffs2reader.c
+++ b/jffsX-utils/jffs2reader.c
@@ -484,18 +484,19 @@ static struct jffs2_raw_inode *find_raw_inode(char *o, size_t size,
if (n < e && je16_to_cpu(n->u.magic) == JFFS2_MAGIC_BITMASK) {
if (je16_to_cpu(n->u.nodetype) == JFFS2_NODETYPE_INODE &&
- je32_to_cpu(n->i.ino) == ino && (v = je32_to_cpu(n->i.version)) > vcur) {
+ je32_to_cpu(n->i.ino) == ino && (v = je32_to_cpu(n->i.version)) > vcur && je32_to_cpu(n->i.csize)) {
/* XXX crc check */
- if (vmaxt < v)
+ if (vmaxt < v) {
vmaxt = v;
- if (vmint > v) {
- vmint = v;
mp = n;
}
+ if (vmint > v) {
+ vmint = v;
+ }
- if (v == (vcur + 1))
- return (&(n->i));
+// if (v == (vcur + 1))
+// return (&(n->i));
}
ADD_BYTES(n, ((je32_to_cpu(n->u.totlen) + 3) & ~3));
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2021-11-09 8:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 8:17 [PATCH 0/4] mtd-utils: adding support for lzma in jffs2reader via liblzma Frederic Germain
2021-11-09 8:17 ` [PATCH 1/4] .gitignore: add new ubiscan utility Frederic Germain
2021-11-09 8:17 ` [PATCH 2/4] Fix warning about unaligned pointer in jffs2reader Frederic Germain
2021-11-09 8:17 ` [PATCH 3/4] jffsX-utils: add lzma support on jffs2reader Frederic Germain
2021-11-09 8:17 ` Frederic Germain [this message]
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=20211109081751.480718-5-frederic.germain@gmail.com \
--to=frederic.germain@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.