Re: [PATCH v4 2/4] kaslr: calculate the memory region in immovable node

From: kbuild test robot
Date: Sat Dec 16 2017 - 06:48:36 EST


Hi Chao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.15-rc3 next-20171215]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Chao-Fan/aslr-add-parameter-immovable_mem-nn-KMG-ss-KMG-to-make-memory-hotplug-work-well-with-kaslr/20171215-175022
config: x86_64-randconfig-g0-12161605 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

arch/x86/boot/compressed/kaslr.c: In function 'process_mem_region':
>> arch/x86/boot/compressed/kaslr.c:671:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < num_immovable_region; i++) {
^
arch/x86/boot/compressed/kaslr.c:671:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

vim +/for +671 arch/x86/boot/compressed/kaslr.c

660
661 static bool process_mem_region(struct mem_vector region,
662 unsigned long long minimum,
663 unsigned long long image_size)
664 {
665 #ifdef CONFIG_MEMORY_HOTPLUG
666 /*
667 * If immovable_mem= specified, walk all immovable regions, and
668 * filter the intersection to slots_count.
669 */
670 if (num_immovable_region > 0) {
> 671 for (int i = 0; i < num_immovable_region; i++) {
672 struct mem_vector entry;
673 unsigned long long start, end, entry_end, region_end;
674
675 start = immovable_mem[i].start;
676 end = start + immovable_mem[i].size;
677 region_end = region.start + region.size;
678
679 entry.start = clamp(region.start, start, end);
680 entry_end = clamp(region_end, start, end);
681
682 if (entry.start < entry_end) {
683 entry.size = entry_end - entry.start;
684 slots_count(&entry, minimum, image_size);
685 }
686
687 if (slot_area_index == MAX_SLOT_AREA) {
688 debug_putstr("Aborted memmap scan (slot_areas full)!\n");
689 return 1;
690 }
691 }
692 return 0;
693 }
694 #endif
695
696 /*
697 * If no immovable_mem stored, or CONFIG_MEMORY_HOTPLUG not specified,
698 * use region directly
699 */
700 slots_count(&region, minimum, image_size);
701 if (slot_area_index == MAX_SLOT_AREA) {
702 debug_putstr("Aborted memmap scan (slot_areas full)!\n");
703 return 1;
704 }
705 return 0;
706 }
707

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip