Otherwise, if length of main device path is equal to MAX_PATH_LEN, it will trigger assert() as below:
[ASSERT] (init_sb_info:1264) !strcmp((char *)sb->devs[i].path, (char *)c.devices[i].path) This is because there is no null character in the end of devcie path string, result in out-of-boundary access in devs.path[]. Let's use strncmp instead of strcmp to compare device path to fix this issue. Signed-off-by: Chao Yu <c...@kernel.org> --- fsck/mount.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fsck/mount.c b/fsck/mount.c index dbbeb56..a1c4cbb 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -1261,8 +1261,9 @@ int init_sb_info(struct f2fs_sb_info *sbi) if (get_device_info(i)) ASSERT(0); } else if (c.func != INJECT) { - if (strcmp((char *)sb->devs[i].path, - (char *)c.devices[i].path)) { + if (strncmp((char *)sb->devs[i].path, + (char *)c.devices[i].path, + MAX_PATH_LEN)) { MSG(0, "paths mismatch: %s, %s\n", (char *)sb->devs[i].path, (char *)c.devices[i].path); -- 2.49.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel