public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] elf_fdpic: fix unused variable warning
@ 2017-10-12  9:46 Arnd Bergmann
  2017-10-12 15:21 ` Nicolas Pitre
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2017-10-12  9:46 UTC (permalink / raw)
  To: Nicolas Pitre, Alexander Viro
  Cc: Arnd Bergmann, Ingo Molnar, Frederic Weisbecker, Nicolas Pitre,
	linux-fsdevel, linux-kernel

The elf_fdpic code shows a harmless warning when built with MMU
enabled, I ran into this now that the configuration is possible
on ARM randconfig builds:

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: 382e67aec6a7 ("ARM: enable elf_fdpic on systems with an MMU")
Fixes: e6c1baa9b562 ("convert the rest of binfmt_elf_fdpic to dump_emit()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Who should pick this up? I guess it could go through either the
ARM tree that introduced the warning for ARM and contains a number
of fdpic patches, or it could go through the VFS tree.
---
 fs/binfmt_elf_fdpic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 5429b035e249..429326b6e2e7 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -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;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] elf_fdpic: fix unused variable warning
  2017-10-12  9:46 Arnd Bergmann
@ 2017-10-12 15:21 ` Nicolas Pitre
  2017-10-12 15:27   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Pitre @ 2017-10-12 15:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexander Viro, Ingo Molnar, Frederic Weisbecker, linux-fsdevel,
	linux-kernel

On Thu, 12 Oct 2017, Arnd Bergmann wrote:

> The elf_fdpic code shows a harmless warning when built with MMU
> enabled, I ran into this now that the configuration is possible
> on ARM randconfig builds:
> 
> 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]

In fact the warning appears when built *without* MMU.

> This adds another #ifdef around the variable declaration to shut
> up the warning.
> 
> Fixes: 382e67aec6a7 ("ARM: enable elf_fdpic on systems with an MMU")

This annotation is wrong as the warning goes away when CONFIG_MMU=y.

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

That is the real culprit.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

With the changelog fixed...

Acked-by: Nicolas Pitre <nico@linaro.org>

> ---
> Who should pick this up? I guess it could go through either the
> ARM tree that introduced the warning for ARM and contains a number
> of fdpic patches, or it could go through the VFS tree.

Given the above I'd say the VFS tree.


Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] elf_fdpic: fix unused variable warning
  2017-10-12 15:21 ` Nicolas Pitre
@ 2017-10-12 15:27   ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2017-10-12 15:27 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Alexander Viro, Ingo Molnar, Frederic Weisbecker,
	Linux FS-devel Mailing List, Linux Kernel Mailing List

On Thu, Oct 12, 2017 at 5:21 PM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
> On Thu, 12 Oct 2017, Arnd Bergmann wrote:
>
>> The elf_fdpic code shows a harmless warning when built with MMU
>> enabled, I ran into this now that the configuration is possible
>> on ARM randconfig builds:
>>
>> 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]
>
> In fact the warning appears when built *without* MMU.

Ah, of course.

>> Who should pick this up? I guess it could go through either the
>> ARM tree that introduced the warning for ARM and contains a number
>> of fdpic patches, or it could go through the VFS tree.
>
> Given the above I'd say the VFS tree.

Ok, I'll create a new version, thanks for taking a look.

      Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] elf_fdpic: fix unused variable warning
@ 2017-10-12 15:31 Arnd Bergmann
  2017-10-12 15:34 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2017-10-12 15:31 UTC (permalink / raw)
  To: Alexander Viro
  Cc: Nicolas Pitre, Arnd Bergmann, Ingo Molnar, Nicolas Pitre,
	Frederic Weisbecker, Mickael GUENE, linux-fsdevel, linux-kernel

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()")
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: fixed changelog text
---
 fs/binfmt_elf_fdpic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 5429b035e249..429326b6e2e7 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -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;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] elf_fdpic: fix unused variable warning
  2017-10-12 15:31 [PATCH] elf_fdpic: fix unused variable warning Arnd Bergmann
@ 2017-10-12 15:34 ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2017-10-12 15:34 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Nicolas Pitre, Ingo Molnar, Nicolas Pitre, Frederic Weisbecker,
	Mickael GUENE, linux-fsdevel, linux-kernel

On Thu, Oct 12, 2017 at 05:31:46PM +0200, Arnd Bergmann wrote:
> 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()")
> Acked-by: Nicolas Pitre <nico@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied...

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-12 15:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12 15:31 [PATCH] elf_fdpic: fix unused variable warning Arnd Bergmann
2017-10-12 15:34 ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2017-10-12  9:46 Arnd Bergmann
2017-10-12 15:21 ` Nicolas Pitre
2017-10-12 15:27   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox