Blame SOURCES/kexec-tools-2.0.4-makedumpfile-Use-divideup-to-calculate-maximum-required-bit.patch

ab224c
From f8c8218856effc43ea01cd9394761cfb8aeaa8df Mon Sep 17 00:00:00 2001
ab224c
Message-Id: <f8c8218856effc43ea01cd9394761cfb8aeaa8df.1382423400.git.bhe@redhat.com>
ab224c
In-Reply-To: <a785fa7dd7a7bd7dcbb017d0bea8848243b0924f.1382423400.git.bhe@redhat.com>
ab224c
References: <a785fa7dd7a7bd7dcbb017d0bea8848243b0924f.1382423400.git.bhe@redhat.com>
ab224c
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
ab224c
Date: Thu, 12 Sep 2013 13:19:00 +0900
ab224c
Subject: [PATCH 2/2] [PATCH] Use divideup() to calculate maximum required
ab224c
 bitmap size.
ab224c
ab224c
Currently, check_cyclic_buffer_overrun() wrongly calculates maximum
ab224c
bitmap size required to represent maximum block size managed by buddy
ab224c
allocator with roundup(). Then, max_block_size is BITPERBYTE-time
ab224c
larger than its correct size. As a result, although the bug never
ab224c
affect free-page filtering since roundup(max_order_nr_pages,
ab224c
BITPERBYTE) is a multiple of divideup(max_order_nr_pages, BITPERBYTE),
ab224c
the following sanity check, (max_block_size > info->bufsize_cyclic),
ab224c
and recalculation of info->bufsize_cyclic becomes BITPERBYTE-time
ab224c
conservative and inefficient.
ab224c
ab224c
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
ab224c
---
ab224c
 makedumpfile.c | 5 ++---
ab224c
 1 file changed, 2 insertions(+), 3 deletions(-)
ab224c
ab224c
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
ab224c
index 164b3f1..1718f88 100644
ab224c
--- a/makedumpfile-1.5.4/makedumpfile.c
ab224c
+++ b/makedumpfile-1.5.4/makedumpfile.c
ab224c
@@ -4078,10 +4078,9 @@ check_cyclic_buffer_overrun(void)
ab224c
 {
ab224c
 	int max_order = ARRAY_LENGTH(zone.free_area);
ab224c
 	int max_order_nr_pages = 1 << (max_order - 1);
ab224c
-	unsigned long max_block_size = roundup(max_order_nr_pages, BITPERBYTE);
ab224c
+	unsigned long max_block_size = divideup(max_order_nr_pages, BITPERBYTE);
ab224c
 
ab224c
-	if (info->bufsize_cyclic %
ab224c
-	    roundup(max_order_nr_pages, BITPERBYTE)) {
ab224c
+	if (info->bufsize_cyclic % max_block_size) {
ab224c
 		unsigned long bufsize;
ab224c
 
ab224c
 		if (max_block_size > info->bufsize_cyclic) {
ab224c
-- 
ab224c
1.8.3.1
ab224c