From bde6d1f1d3f9551fa4ca65247e210c8ac7814168 Mon Sep 17 00:00:00 2001
From: Jialong Chen <chenjialong@huawei.com>
Date: Tue, 3 Dec 2019 20:26:55 +0000
Subject: [PATCH] fix header offset overflow when large pfn

info->len_bitmap=0x182000000
dh->bitmap_blocks * dh->block_size = info->len_bitmap=0x182000000 > int range
so:
cd_header->offset = (DISKDUMP_HEADER_BLOCKS + dh->sub_hdr_size + dh->bitmap_blocks) * dh->block_size;
get cd_header->offset = 0x82015000, but correct size is 0x182015000
so we set DISKDUMP_HEADER_BLOCKS to 1UL.

when cd_header->offset overflow, and cd_page->offset get an error offset. 
cd_page->offset = cd_header->offset + sizeof(page_desc_t)*info->num_dumpable
later write page data will cover bitmap2.

Signed-off-by: Jialong Chen <chenjialong@huawei.com>
---
 makedumpfile-1.6.4/diskdump_mod.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makedumpfile-1.6.7/diskdump_mod.h b/makedumpfile-1.6.7/diskdump_mod.h
index 2676817..3733953 100644
--- a/makedumpfile-1.6.7/diskdump_mod.h
+++ b/makedumpfile-1.6.7/diskdump_mod.h
@@ -22,7 +22,7 @@
 #define DISK_DUMP_SIGNATURE		"DISKDUMP"
 #define KDUMP_SIGNATURE			"KDUMP   "
 #define SIG_LEN (sizeof(DUMP_PARTITION_SIGNATURE) - 1)
-#define DISKDUMP_HEADER_BLOCKS		(1)
+#define DISKDUMP_HEADER_BLOCKS		(1UL)
 
 /*
  * These are all remnants of the old "diskdump" facility,
-- 
1.8.3.1

