* [PATCH 1/4] fsck.f2fs: free cp_page_1 in validate_checkpoint
@ 2016-09-29 10:38 Junling Zheng
2016-09-29 10:38 ` [PATCH 2/4] fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount Junling Zheng
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Junling Zheng @ 2016-09-29 10:38 UTC (permalink / raw)
To: linux-f2fs-devel
Free cp_page_1 in validate_checkpoint to avoid memory leak.
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
---
fsck/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index 3be60bb..e390b26 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -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);
--
2.7.4
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount
2016-09-29 10:38 [PATCH 1/4] fsck.f2fs: free cp_page_1 in validate_checkpoint Junling Zheng
@ 2016-09-29 10:38 ` Junling Zheng
2016-09-29 10:38 ` [PATCH 3/4] fsck.f2fs: fix a typo in check_sector_size Junling Zheng
2016-09-29 10:38 ` [PATCH 4/4] f2fs: unify the length of versions Junling Zheng
2 siblings, 0 replies; 7+ messages in thread
From: Junling Zheng @ 2016-09-29 10:38 UTC (permalink / raw)
To: linux-f2fs-devel
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
---
fsck/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index e390b26..a247dec 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -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;
}
--
2.7.4
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] fsck.f2fs: fix a typo in check_sector_size
2016-09-29 10:38 [PATCH 1/4] fsck.f2fs: free cp_page_1 in validate_checkpoint Junling Zheng
2016-09-29 10:38 ` [PATCH 2/4] fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount Junling Zheng
@ 2016-09-29 10:38 ` Junling Zheng
2016-09-29 10:38 ` [PATCH 4/4] f2fs: unify the length of versions Junling Zheng
2 siblings, 0 replies; 7+ messages in thread
From: Junling Zheng @ 2016-09-29 10:38 UTC (permalink / raw)
To: linux-f2fs-devel
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
---
fsck/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index a247dec..5f51009 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -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;
--
2.7.4
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] f2fs: unify the length of versions
2016-09-29 10:38 [PATCH 1/4] fsck.f2fs: free cp_page_1 in validate_checkpoint Junling Zheng
2016-09-29 10:38 ` [PATCH 2/4] fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount Junling Zheng
2016-09-29 10:38 ` [PATCH 3/4] fsck.f2fs: fix a typo in check_sector_size Junling Zheng
@ 2016-09-29 10:38 ` Junling Zheng
2016-09-30 16:25 ` Jaegeuk Kim
2 siblings, 1 reply; 7+ messages in thread
From: Junling Zheng @ 2016-09-29 10:38 UTC (permalink / raw)
To: linux-f2fs-devel
Currently, 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.
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
---
include/f2fs_fs.h | 6 +++---
lib/libf2fs.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 1345e2d..e666076 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -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;
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 706cc34..0a9436b 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -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)
--
2.7.4
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] f2fs: unify the length of versions
2016-09-29 10:38 ` [PATCH 4/4] f2fs: unify the length of versions Junling Zheng
@ 2016-09-30 16:25 ` Jaegeuk Kim
2016-10-08 1:08 ` Junling Zheng
0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2016-09-30 16:25 UTC (permalink / raw)
To: Junling Zheng; +Cc: linux-f2fs-devel
On Thu, Sep 29, 2016 at 06:38:37PM +0800, Junling Zheng wrote:
> Currently, 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.
This is to handle non-zero terminated version characters in f2fs_super_block.
What is your point?
Thanks,
>
> Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
> ---
> include/f2fs_fs.h | 6 +++---
> lib/libf2fs.c | 4 ++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index 1345e2d..e666076 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -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;
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 706cc34..0a9436b 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -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)
> --
> 2.7.4
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> 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] 7+ messages in thread
* Re: [PATCH 4/4] f2fs: unify the length of versions
2016-09-30 16:25 ` Jaegeuk Kim
@ 2016-10-08 1:08 ` Junling Zheng
2016-10-10 16:49 ` Jaegeuk Kim
0 siblings, 1 reply; 7+ messages in thread
From: Junling Zheng @ 2016-10-08 1:08 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
On 2016/10/1 0:25, Jaegeuk Kim wrote:
> On Thu, Sep 29, 2016 at 06:38:37PM +0800, Junling Zheng wrote:
>> Currently, 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.
>
> 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
>>
>> Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
>> ---
>> include/f2fs_fs.h | 6 +++---
>> lib/libf2fs.c | 4 ++--
>> 2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
>> index 1345e2d..e666076 100644
>> --- a/include/f2fs_fs.h
>> +++ b/include/f2fs_fs.h
>> @@ -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;
>> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
>> index 706cc34..0a9436b 100644
>> --- a/lib/libf2fs.c
>> +++ b/lib/libf2fs.c
>> @@ -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)
>> --
>> 2.7.4
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] f2fs: unify the length of versions
2016-10-08 1:08 ` Junling Zheng
@ 2016-10-10 16:49 ` Jaegeuk Kim
0 siblings, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2016-10-10 16:49 UTC (permalink / raw)
To: Junling Zheng; +Cc: linux-f2fs-devel
On Sat, Oct 08, 2016 at 09:08:54AM +0800, Junling Zheng wrote:
> On 2016/10/1 0:25, Jaegeuk Kim wrote:
> > On Thu, Sep 29, 2016 at 06:38:37PM +0800, Junling Zheng wrote:
> >> Currently, 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.
> >
> > 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);
> ...
Then, I think we need to fix this line to avoid garbage when printing out.
Thanks,
>
> Thanks,
> Junling
>
> >>
> >> Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
> >> ---
> >> include/f2fs_fs.h | 6 +++---
> >> lib/libf2fs.c | 4 ++--
> >> 2 files changed, 5 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> >> index 1345e2d..e666076 100644
> >> --- a/include/f2fs_fs.h
> >> +++ b/include/f2fs_fs.h
> >> @@ -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;
> >> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> >> index 706cc34..0a9436b 100644
> >> --- a/lib/libf2fs.c
> >> +++ b/lib/libf2fs.c
> >> @@ -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)
> >> --
> >> 2.7.4
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> _______________________________________________
> >> Linux-f2fs-devel mailing list
> >> Linux-f2fs-devel@lists.sourceforge.net
> >> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-10-10 16:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 10:38 [PATCH 1/4] fsck.f2fs: free cp_page_1 in validate_checkpoint Junling Zheng
2016-09-29 10:38 ` [PATCH 2/4] fsck.f2fs: fix incorrect ERR_MSG in f2fs_do_mount Junling Zheng
2016-09-29 10:38 ` [PATCH 3/4] fsck.f2fs: fix a typo in check_sector_size Junling Zheng
2016-09-29 10:38 ` [PATCH 4/4] f2fs: unify the length of versions Junling Zheng
2016-09-30 16:25 ` Jaegeuk Kim
2016-10-08 1:08 ` Junling Zheng
2016-10-10 16:49 ` Jaegeuk Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.