fsck.f2fs: free cp_page_1 in validate_checkpoint
PATCH 1/4 fsck.f2fs: free cp_page_1 in validate_checkpoint
Free cp_page_1 in validate_checkpoint to avoid memory leak.
--- fsck/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/mount.c +1 -1
@@ -494,7 +494,7 @@ void *validate_checkpoint(struct f2fs_sb_info *sbi, block_t cp_addr,/* Read the 1st cp block in this CP pack */ cp_page_1 =malloc (PAGE_SIZE );if (dev_read_block (cp_page_1, cp_addr) <0 ) -return NULL ; + goto invalid_cp1; cp = (struct f2fs_checkpoint *)cp_page_1; crc_offset =get_cp (checksum_offset);
Signature · 4 lines
2.7.4 ------------------------------------------------------------------------------
PATCH 2/4 fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount
--- fsck/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/mount.c +1 -1
@@ -1978,7 +1978,7 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi) }if (build_node_manager (sbi)) { -ERR_MSG ("build_segment_manager failed\n" ); +ERR_MSG ("build_node_manager failed\n" );return -1 ; }
Signature · 4 lines
2.7.4 ------------------------------------------------------------------------------
PATCH 3/4 fsck.f2fs: fix a typo in check_sector_size
In reply to Junling Zheng--- fsck/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/mount.c +1 -1
@@ -1908,7 +1908,7 @@ static int check_sector_size(struct f2fs_super_block *sb)DBG (1 ,"\tWriting super block, at offset 0x%08x\n" ,0 );for (index =0 ; index <2 ; index++) {if (dev_write (zero_buff, index *F2FS_BLKSIZE ,F2FS_BLKSIZE )) { -MSG (1 ,"\tError: While while writing supe_blk " +MSG (1 ,"\tError: Failed while writing supe_blk " "on disk!!! index : %d\n" , index);free (zero_buff);return -1 ;
Signature · 4 lines
2.7.4 ------------------------------------------------------------------------------
PATCH 4/4 f2fs: unify the length of versions
In reply to Junling ZhengCurrently, versions in f2fs_configuration have one more byte, so versions in f2fs_super_block may not end with '\0', which will cause errors while printing it in print_raw_sb_info(). Unify the length of versions to fix it.
--- include/f2fs_fs.h | 6 +++--- lib/libf2fs.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
include/f2fs_fs.h +3 -3
@@ -270,9 +270,9 @@ struct f2fs_configuration {u_int64_t target_sectors;u_int32_t sectors_per_blk;u_int32_t blks_per_seg; -__u8 init_version[VERSION_LEN +1 ]; -__u8 sb_version[VERSION_LEN +1 ]; -__u8 version[VERSION_LEN +1 ]; +__u8 init_version[VERSION_LEN ]; +__u8 sb_version[VERSION_LEN ]; +__u8 version[VERSION_LEN ];char *vol_label;int heap;int32_t fd, kd;
lib/libf2fs.c +2 -2
@@ -570,11 +570,11 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)void get_kernel_version (__u8 *version) {int i; -for (i =0 ; i <VERSION_LEN ; i++) { +for (i =0 ; i <VERSION_LEN -1 ; i++) {if (version[i] =='\n' )break ; } -memset (version + i,0 ,VERSION_LEN +1 - i); +memset (version + i,0 ,VERSION_LEN - i); }int f2fs_get_device_info (struct f2fs_configuration *c)
Signature · 4 lines
2.7.4 ------------------------------------------------------------------------------
Re: [PATCH 4/4] f2fs: unify the length of versions
Quoted 3 lines · Junling Zheng
Currently, versions in
f2fs_configurationhave one more byte, so versions inf2fs_super_blockmay not end with '\0', which will cause errors while printing it inprint_raw_sb_info(). Unify the length of versions to fix it.
This is to handle non-zero terminated version characters in f2fs_super_block. What is your point?
Thanks,
Quoted 51 lines
Signed-off-by Junling Zheng <[email protected]>--- include/f2fs_fs.h | 6 +++--- lib/libf2fs.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)include/f2fs_fs.h +3
-3@@ -270,9 +270,9 @@ struct f2fs_configuration {u_int64_t target_sectors;u_int32_t sectors_per_blk;u_int32_t blks_per_seg; -__u8 init_version[VERSION_LEN +1 ]; -__u8 sb_version[VERSION_LEN +1 ]; -__u8 version[VERSION_LEN +1 ]; +__u8 init_version[VERSION_LEN ]; +__u8 sb_version[VERSION_LEN ]; +__u8 version[VERSION_LEN ];char *vol_label;int heap;int32_t fd, kd;lib/libf2fs.c +2
-2@@ -570,11 +570,11 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)void get_kernel_version (__u8 *version) {int i; -for (i =0 ; i <VERSION_LEN ; i++) { +for (i =0 ; i <VERSION_LEN -1 ; i++) {if (version[i] =='\n' )break ; } -memset (version + i,0 ,VERSION_LEN +1 - i); +memset (version + i,0 ,VERSION_LEN - i); }int f2fs_get_device_info (struct f2fs_configuration *c)Signature · 8 lines
2.7.4 ------------------------------------------------------------------------------ _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
------------------------------------------------------------------------------
Re: [PATCH 4/4] f2fs: unify the length of versions
Quoted 10 lines · Jaegeuk Kim
Quoted 3 lines · Junling Zheng
Currently, versions in
f2fs_configurationhave one more byte, so versions inf2fs_super_blockmay not end with '\0', which will cause errors while printing it inprint_raw_sb_info(). Unify the length of versions to fix it.This is to handle non-zero terminated version characters in
f2fs_super_block. What is your point?Thanks,
If version characters are non-zero terminated in f2fs_super_block, it will get incorrect results while printing it in print_raw_sb_info():
...DISP("%s", sb, version);
...
Thanks,
Junling
Quoted 46 lines
Quoted 46 lines
Signed-off-by Junling Zheng <[email protected]>--- include/f2fs_fs.h | 6 +++--- lib/libf2fs.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)include/f2fs_fs.h +3
-3@@ -270,9 +270,9 @@ struct f2fs_configuration {u_int64_t target_sectors;u_int32_t sectors_per_blk;u_int32_t blks_per_seg; -__u8 init_version[VERSION_LEN +1 ]; -__u8 sb_version[VERSION_LEN +1 ]; -__u8 version[VERSION_LEN +1 ]; +__u8 init_version[VERSION_LEN ]; +__u8 sb_version[VERSION_LEN ]; +__u8 version[VERSION_LEN ];char *vol_label;int heap;int32_t fd, kd;lib/libf2fs.c +2
-2@@ -570,11 +570,11 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)void get_kernel_version (__u8 *version) {int i; -for (i =0 ; i <VERSION_LEN ; i++) { +for (i =0 ; i <VERSION_LEN -1 ; i++) {if (version[i] =='\n' )break ; } -memset (version + i,0 ,VERSION_LEN +1 - i); +memset (version + i,0 ,VERSION_LEN - i); }int f2fs_get_device_info (struct f2fs_configuration *c)Signature · 1 line
2.7.4
Quoted 8 lines
Quoted 5 lines
------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Re: [PATCH 4/4] f2fs: unify the length of versions
Quoted 9 lines · Junling Zheng
Quoted 8 lines · Jaegeuk Kim
Quoted 3 lines · Junling Zheng
Currently, versions in
f2fs_configurationhave one more byte, so versions inf2fs_super_blockmay not end with '\0', which will cause errors while printing it inprint_raw_sb_info(). Unify the length of versions to fix it.This is to handle non-zero terminated version characters in
f2fs_super_block. What is your point?
Quoted 8 lines
Quoted 2 lines
Thanks,
If version characters are non-zero terminated in
f2fs_super_block, it will get incorrect results while printing it inprint_raw_sb_info():
...DISP("%s", sb, version);
...
Then, I think we need to fix this line to avoid garbage when printing out.
Thanks,
Quoted 59 lines
Thanks,
JunlingQuoted 54 lines
Quoted 51 lines
Signed-off-by Junling Zheng <[email protected]>--- include/f2fs_fs.h | 6 +++--- lib/libf2fs.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)include/f2fs_fs.h +3
-3@@ -270,9 +270,9 @@ struct f2fs_configuration {u_int64_t target_sectors;u_int32_t sectors_per_blk;u_int32_t blks_per_seg; -__u8 init_version[VERSION_LEN +1 ]; -__u8 sb_version[VERSION_LEN +1 ]; -__u8 version[VERSION_LEN +1 ]; +__u8 init_version[VERSION_LEN ]; +__u8 sb_version[VERSION_LEN ]; +__u8 version[VERSION_LEN ];char *vol_label;int heap;int32_t fd, kd;lib/libf2fs.c +2
-2@@ -570,11 +570,11 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)void get_kernel_version (__u8 *version) {int i; -for (i =0 ; i <VERSION_LEN ; i++) { +for (i =0 ; i <VERSION_LEN -1 ; i++) {if (version[i] =='\n' )break ; } -memset (version + i,0 ,VERSION_LEN +1 - i); +memset (version + i,0 ,VERSION_LEN - i); }int f2fs_get_device_info (struct f2fs_configuration *c)Signature · 8 lines
2.7.4 ------------------------------------------------------------------------------ _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot