From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH 2/2] dump.f2fs: check block address first before reading the block
Date: Wed, 15 Jul 2020 10:30:17 -0700 [thread overview]
Message-ID: <20200715173017.1887640-2-jaegeuk@kernel.org> (raw)
In-Reply-To: <20200715173017.1887640-1-jaegeuk@kernel.org>
This should avoid to read out wrong block address.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/dump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fsck/dump.c b/fsck/dump.c
index e472eb7..055ce09 100644
--- a/fsck/dump.c
+++ b/fsck/dump.c
@@ -482,8 +482,6 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)
node_blk = calloc(BLOCK_SZ, 1);
ASSERT(node_blk);
- dev_read_block(node_blk, ni.blk_addr);
-
DBG(1, "Node ID [0x%x]\n", nid);
DBG(1, "nat_entry.block_addr [0x%x]\n", ni.blk_addr);
DBG(1, "nat_entry.version [0x%x]\n", ni.version);
@@ -494,6 +492,8 @@ void dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)
goto out;
}
+ dev_read_block(node_blk, ni.blk_addr);
+
if (ni.blk_addr == 0x0)
MSG(force, "Invalid nat entry\n\n");
else if (!is_sit_bitmap_set(sbi, ni.blk_addr))
--
2.27.0.389.gc38d7665816-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2020-07-15 17:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-15 17:30 [f2fs-dev] [PATCH 1/2] sload.f2fs: fix missing fsck_init Jaegeuk Kim
2020-07-15 17:30 ` Jaegeuk Kim [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=20200715173017.1887640-2-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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;
as well as URLs for NNTP newsgroup(s).