Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d085a5ea authored by Shiraz Hashim's avatar Shiraz Hashim
Browse files

arm: mm: Fix build error due to variable input to BUILD_BUG_ON



BUILD_BUG_ON() expands to a build error based on value of
constant bool parameter passed to it. Presently,
early_fixmap_shutdown while iterating through
permanent_fixed_address and calling fix_to_virt on each of
them, ends up passing non-constant value to the same.

It is observed that with '-Oz' build option LLVM compiler
fails to guess the right value to expand BUILD_BUG_ON and
incorrectly raises following error.

  arch/arm/mm/mmu.o: In function `fix_to_virt':
  include/asm-generic/fixmap.h:31:
  undefined reference to `__compiletime_assert_31'
  make[2]: *** [vmlinux] Error 1
  make[2]: Leaving directory
  `build/kobj'
  make[1]: *** [sub-make] Error 2

Modify early_fixmap_shutdown to bypass fix_to_virt and
directly use __fixt_to_virt and validate boundaries,
passing constant values to BUILD_BUG_ON.

Change-Id: Ib0bd771ec0bdae0fbc00ed0c0df8f716cc0386b5
Signed-off-by: default avatarShiraz Hashim <shashim@codeaurora.org>
parent b7bafeea
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1708,11 +1708,13 @@ static void __init early_fixmap_shutdown(void)
	pmd_clear(fixmap_pmd(va));
	local_flush_tlb_kernel_page(va);

	BUILD_BUG_ON(__end_of_permanent_fixed_addresses >
			__end_of_fixed_addresses);
	for (i = 0; i < __end_of_permanent_fixed_addresses; i++) {
		pte_t *pte;
		struct map_desc map;

		map.virtual = fix_to_virt(i);
		map.virtual = __fix_to_virt(i);
		pte = pte_offset_early_fixmap(pmd_off_k(map.virtual), map.virtual);

		/* Only i/o device mappings are supported ATM */