Skip to contentSkip to conversation

elf_fdpic: fix unused variable warning

PATCH Applied Arnd Bergmann 2 participants 2 messages Oct 12, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 elf_fdpic: fix unused variable warning

The elf_fdpic code shows a harmless warning when built with MMU disabled, I ran into this now that fdpic is available on ARM randconfig builds since commit 50b2b2e691cd ("ARM: add ELF_FDPIC support").

fs/binfmt_elf_fdpic.c: In function 'elf_fdpic_dump_segments':
fs/binfmt_elf_fdpic.c:1501:17: error: unused variable 'addr' [-Werror=unused-variable]

This adds another #ifdef around the variable declaration to shut up the warning.

Fixes e6c1baa9b562 ("convert the rest of binfmt_elf_fdpic to dump_emit()")

---
v2: fixed changelog text

---
 fs/binfmt_elf_fdpic.c | 2 ++
 1 file changed, 2 insertions(+)
fs/binfmt_elf_fdpic.c +2 -0
index 5429b035e249..429326b6e2e7 100644
@@ -1498,7 +1498,9 @@ static bool elf_fdpic_dump_segments(struct coredump_params *cprm)
 	struct vm_area_struct *vma;
 
 	for (vma = current->mm->mmap; vma; vma = vma->vm_next) {
+#ifdef CONFIG_MMU
 		unsigned long addr;
+#endif
 
 		if (!maydump(vma, cprm->mm_flags))
 			continue;
Signature · 1 line
2.9.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Arnd Bergmann

The elf_fdpic code shows a harmless warning when built with MMU disabled, I ran into this now that fdpic is available on ARM randconfig builds since commit 50b2b2e691cd ("ARM: add ELF_FDPIC support").

fs/binfmt_elf_fdpic.c: In function 'elf_fdpic_dump_segments':
fs/binfmt_elf_fdpic.c:1501:17: error: unused variable 'addr' [-Werror=unused-variable]

Quoted 6 lines

This adds another #ifdef around the variable declaration to shut up the warning.

Fixes e6c1baa9b562 ("convert the rest of binfmt_elf_fdpic to dump_emit()")

Applied...