>> At that time, I chose the current code since it was simpler and safer. >> http://www.mail-archive.com/kexec%40lists.infradead.org/msg10207.html >> >> Don't you like this ? >> > >Sorry. I had forgotten this. We should keep the sanity check >there. But in our policy, we should not pass to set_bitmap_cyclic(), >pfn and cycle where pfn is not in the cycle. We should chceck that in >the caller side and pass pfn in the cycle only. > >Also, on the current implementation, even if pfn outside a current >cycle is passed to set_bitmap_cyclic(), we don't have any means to >know that. > >So, how about warning that only once at runtime? Sounds good, it will be helpful to detect bugs in caller side. Like this? diff --git a/makedumpfile.c b/makedumpfile.c index 75092a8..da960ad 100644 --- a/makedumpfile.c +++ b/makedumpfile.c @@ -3361,9 +3361,16 @@ int set_bitmap_cyclic(char *bitmap, unsigned long long pfn, int val, struct cycle *cycle) { int byte, bit; + static int warning = 0; - if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn) + if (pfn < cycle->start_pfn || cycle->end_pfn <= pfn) { + if (!warning) { + MSG("WARNING: PFN out of cycle range. (pfn:%llx, ", pfn); + MSG("cycle:[%llx-%llx])\n", cycle->start_pfn, cycle->end_pfn); + warning = 1; + } return FALSE; + } /* * If val is 0, clear bit on the bitmap. Thanks Atsushi Kumagai