When using fiemap to obtain the block address of files
larger than 2GB ((2147483647+1) bytes), an integer
multiplication overflow error will occur.
This issue is caused by the following code:
start = atoi(argv[1]) * F2FS_BLKSIZE;
length = atoi(argv[2]) * F2FS_BLKSIZE;
Signed-off-by: zangyangyang1 <[email protected]>
---
tools/f2fs_io/f2fs_io.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 5bc0baf..ad6b5f0 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -809,15 +809,15 @@ static void do_fiemap(int argc, char **argv, const struct
cmd_desc *cmd)
}
memset(fm, 0, sizeof(struct fiemap));
- start = atoi(argv[1]) * F2FS_BLKSIZE;
- length = atoi(argv[2]) * F2FS_BLKSIZE;
- fm->fm_start = start;
- fm->fm_length = length;
+ start = atoll(argv[1]);
+ length = atoll(argv[2]);
+ fm->fm_start = start * F2FS_BLKSIZE;
+ fm->fm_length = length * F2FS_BLKSIZE;
fd = xopen(argv[3], O_RDONLY | O_LARGEFILE, 0);
printf("Fiemap: offset = %"PRIu64" len = %"PRIu64"\n",
- start / F2FS_BLKSIZE, length / F2FS_BLKSIZE);
+ start, length);
if (ioctl(fd, FS_IOC_FIEMAP, fm) < 0)
die_errno("FIEMAP failed");
--
2.40.1
#/******±¾Óʼþ¼°Æä¸½¼þº¬ÓÐСÃ×¹«Ë¾µÄ±£ÃÜÐÅÏ¢£¬½öÏÞÓÚ·¢Ë͸øÉÏÃæµØÖ·ÖÐÁгöµÄ¸öÈË»òȺ×é¡£½ûÖ¹ÈÎºÎÆäËûÈËÒÔÈκÎÐÎʽʹÓ㨰üÀ¨µ«²»ÏÞÓÚÈ«²¿»ò²¿·ÖµØÐ¹Â¶¡¢¸´ÖÆ¡¢»òÉ¢·¢£©±¾ÓʼþÖеÄÐÅÏ¢¡£Èç¹ûÄú´íÊÕÁ˱¾Óʼþ£¬ÇëÄúÁ¢¼´µç»°»òÓʼþ֪ͨ·¢¼þÈ˲¢É¾³ý±¾Óʼþ£¡
This e-mail and its attachments contain confidential information from XIAOMI,
which is intended only for the person or entity whose address is listed above.
Any use of the information contained herein in any way (including, but not
limited to, total or partial disclosure, reproduction, or dissemination) by
persons other than the intended recipient(s) is prohibited. If you receive this
e-mail in error, please notify the sender by phone or email immediately and
delete it!******/#
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel