From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Dylan Chang <y.w.zhang14@gmail.com>
Cc: Dylan Chang <dylan.chang@oneplus.com>,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] Fix file too large causing overflow
Date: Thu, 16 Jun 2022 10:17:08 -0700 [thread overview]
Message-ID: <YqtllO83cEw1jb+Q@google.com> (raw)
In-Reply-To: <20220616035806.1663-1-dylan.chang@oneplus.com>
On 06/16, Dylan Chang wrote:
> fibmap: Fix file too large causing file_pos overflow
>
> fibmap show file_pos with incorrectly value when passing a large file.
>
> Before:
>
> ----------------file info-------------------
> /data/media/0/data1 :
> --------------------------------------------
> dev [254:18]
> ino [0x 4db1 : 19889]
> mode [0x 81b0 : 33200]
> nlink [0x 1 : 1]
> uid [0x 280e : 10254]
> gid [0x 3ff : 1023]
> size [0x1b3dca314 : 7312548628]
> blksize [0x 1000 : 4096]
> blocks [0x da2530 : 14296368]
> --------------------------------------------
>
> file_pos start_blk end_blk blks
> 0 3197602 3198463 862
> 3530752 3197509 3197509 1
> 3534848 3197557 3197578 22
> 3624960 3198464 3396701 198238
> 815607808 3396703 3632480 235778
> 1781354496 3632482 3652095 19614
> 1861693440 3396702 3396702 1
> 1861697536 3632481 3632481 1
> 1861701632 1514948 1514948 1
> 1861705728 1518774 1518774 1
> 1861709824 2543104 2543125 22
> ...
> 1862111232 2457813 2457813 1
> 1862115328 3652096 3878168 226073
> -1506856960 3878170 4133725 255556
> -460099584 1510048 1510052 5
>
> Patched:
> ----------------file info-------------------
> /data/media/0/data1 :
> --------------------------------------------
> dev [254:18]
> ino [0x 4db1 : 19889]
> mode [0x 81b0 : 33200]
> nlink [0x 1 : 1]
> uid [0x 280e : 10254]
> gid [0x 3ff : 1023]
> size [0x1b3dca314 : 7312548628]
> blksize [0x 1000 : 4096]
> blocks [0x da2530 : 14296368]
> --------------------------------------------
>
> file_pos start_blk end_blk blks
> 0 3197602 3198463 862
> 3530752 3197509 3197509 1
> 3534848 3197557 3197578 22
> 3624960 3198464 3396701 198238
> 815607808 3396703 3632480 235778
> 1781354496 3632482 3652095 19614
> 1861693440 3396702 3396702 1
> 1861697536 3632481 3632481 1
> 1861701632 1514948 1514948 1
> 1861705728 1518774 1518774 1
> 1861709824 2543104 2543125 22
> ...
> 1862111232 2457813 2457813 1
> 1862115328 3652096 3878168 226073
> 2788110336 3878170 4133725 255556
> 3834867712 1510048 1510052 5
>
> Change-Id: Ic2486e25ea03114d4dbf3651650c6a2399db0714
> Signed-off-by: Dylan Chang <dylan.chang@oneplus.com>
> ---
> tools/fibmap.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/fibmap.c b/tools/fibmap.c
> index 3238f29..3217600 100644
> --- a/tools/fibmap.c
> +++ b/tools/fibmap.c
> @@ -47,7 +47,7 @@
> #endif
>
> struct file_ext {
> - __u32 f_pos;
> + __u64 f_pos;
> __u32 start_blk;
> __u32 end_blk;
> __u32 blk_count;
> @@ -56,9 +56,9 @@ struct file_ext {
> void print_ext(struct file_ext *ext)
> {
> if (ext->end_blk == 0)
> - printf("%8d %8d %8d %8d\n", ext->f_pos, 0, 0, ext->blk_count);
> + printf("%8llu %8lu %8lu %8lu\n", ext->f_pos, 0, 0, ext->blk_count);
I had to fix unrelated changes from %8d to %8lu. Please check it
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?h=dev-test&id=74f81f441ce24dd47cfe68e6fb336e0142bf4217
> else
> - printf("%8d %8d %8d %8d\n", ext->f_pos, ext->start_blk,
> + printf("%8llu %8lu %8lu %8lu\n", ext->f_pos, ext->start_blk,
> ext->end_blk, ext->blk_count);
> }
>
> @@ -209,7 +209,7 @@ int main(int argc, char *argv[])
> ext.blk_count++;
> } else {
> print_ext(&ext);
> - ext.f_pos = i * st.st_blksize;
> + ext.f_pos = (__u64)i * st.st_blksize;
> ext.start_blk = blknum;
> ext.end_blk = blknum;
> ext.blk_count = 1;
> --
> 2.17.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-06-16 17:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 3:58 [f2fs-dev] [PATCH] Fix file too large causing overflow Dylan Chang
2022-06-16 17:17 ` Jaegeuk Kim [this message]
2022-06-17 2:10 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YqtllO83cEw1jb+Q@google.com \
--to=jaegeuk@kernel.org \
--cc=dylan.chang@oneplus.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=y.w.zhang14@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.