On 2018/2/7 18:01, Sheng Yong wrote:

[...]
+
+    /* lookup lost+found in root directory */
+    lpf_ino = f2fs_lookup(sbi, node, (u8 *) LPF, strlen(LPF));

The 4th parameter should be namelen but not strlen(LPF).
Sorry for the noise. The comment here is wrong :(

[...]
+
+static int fsck_do_reconnect_file(struct f2fs_sb_info *sbi,
+                  struct f2fs_node *lpf,
+                  struct f2fs_node *fnode)
+{
+    char name[80];
+    size_t namelen;
+    nid_t ino = le32_to_cpu(fnode->footer.ino);
+    struct node_info ni;
+    int ret;
+
+    namelen = snprintf(name, 80, "%u", ino);
+    if (namelen >= 80)
+        /* ignore terminating '\0', should never happen */
+        namelen = 79;
+
+    if (f2fs_lookup(sbi, lpf, (u8 *) name, strlen(LPF))) {

The 4th parameter should be namelen but not strlen(LPF).

+        ASSERT_MSG("Name %s already exist in lost+found", name);
+        return -EEXIST;
+    }
+
[...]



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to