[PATCH 4/4] find_raw_inode returns latest version with data of inode
Frederic Germain
frederic.germain at gmail.com
Tue Nov 9 00:17:51 PST 2021
Signed-off-by: Frederic Germain <frederic.germain at 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
More information about the linux-mtd
mailing list