Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* [f2fs-dev] [PATCH 1/2] sload.f2fs: fix missing fsck_init
@ 2020-07-15 17:30 Jaegeuk Kim
  2020-07-15 17:30 ` [f2fs-dev] [PATCH 2/2] dump.f2fs: check block address first before reading the block Jaegeuk Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Jaegeuk Kim @ 2020-07-15 17:30 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch allocates some data structures that will be used for loading files
on existing image.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fsck/sload.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fsck/sload.c b/fsck/sload.c
index c064f7f..59ba4a6 100644
--- a/fsck/sload.c
+++ b/fsck/sload.c
@@ -313,6 +313,9 @@ int f2fs_sload(struct f2fs_sb_info *sbi)
 {
 	int ret = 0;
 
+	/* this requires for the below sanity checks */
+	fsck_init(sbi);
+
 	ret = configure_files();
 	if (ret) {
 		ERR_MSG("Failed to configure files\n");
-- 
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [f2fs-dev] [PATCH 2/2] dump.f2fs: check block address first before reading the block
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2020-07-15 17:30 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 17:30 [f2fs-dev] [PATCH 1/2] sload.f2fs: fix missing fsck_init Jaegeuk Kim
2020-07-15 17:30 ` [f2fs-dev] [PATCH 2/2] dump.f2fs: check block address first before reading the block Jaegeuk Kim

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git