[PATCH] erofs-utils: lib: fix two integer handling issues
Gao Xiang
hsiangkao at linux.alibaba.com
Tue Jun 17 19:42:04 AEST 2025
Coverity-id: 554931
Coverity-id: 555116
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/super.c | 5 +++++
lib/vmdk.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/super.c b/lib/super.c
index beab74e..a300a5f 100644
--- a/lib/super.c
+++ b/lib/super.c
@@ -327,6 +327,11 @@ int erofs_write_device_table(struct erofs_sb_info *sbi)
return -EINVAL;
pos = erofs_btell(bh, false);
+ if (pos == NULL_ADDR_UL) {
+ DBG_BUGON(1);
+ return -EINVAL;
+ }
+
i = 0;
do {
struct erofs_deviceslot dis = {
diff --git a/lib/vmdk.c b/lib/vmdk.c
index 06d4a49..8080c51 100644
--- a/lib/vmdk.c
+++ b/lib/vmdk.c
@@ -60,7 +60,7 @@ int erofs_dump_vmdk_desc(FILE *f, struct erofs_sb_info *sbi)
const char *name = sbi->devs[i].src_path ?:
(const char *)sbi->devs[i].tag;
- sectors = sbi->devs[i].blocks << (sbi->blkszbits - 9);
+ sectors = (u64)sbi->devs[i].blocks << (sbi->blkszbits - 9);
ret = erofs_vmdk_desc_add_extent(f, sectors, name, 0);
if (ret)
return ret;
--
2.43.5
More information about the Linux-erofs
mailing list