* Ignored return value of __clear_user in fs/binfmt_elf.c?
@ 2005-02-23 17:27 Horst von Brand
2005-02-24 0:54 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Horst von Brand @ 2005-02-23 17:27 UTC (permalink / raw)
To: linux-kernel
Machine is sparc64, bk of today, gcc-3.4.2-6.fc3 (Aurora Corona). First 2.6
I try to build here, so it might be something known.
Build fails due to -Werror with:
include/asm/uaccess.h: In function `load_elf_binary':
arch/sparc64/kernel/../../../fs/binfmt_elf.c:811: warning: ignoring return value of `__clear_user', declared with attribute warn_unused_result
Around line 811 of fs/binfmt_elf.c I see:
/*
* This bss-zeroing can fail if the ELF file
* specifies odd protections. So we don't check * the return value
*/
(void)clear_user((void __user *)elf_bss +
load_bias, nbyte);
so presumably this discarding is OK here...
I wonder why an explicit (void) cast is not considered "use" by the
compiler. But then again, explicitly throwing away isn't really "use"...
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Ignored return value of __clear_user in fs/binfmt_elf.c?
2005-02-23 17:27 Ignored return value of __clear_user in fs/binfmt_elf.c? Horst von Brand
@ 2005-02-24 0:54 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-02-24 0:54 UTC (permalink / raw)
To: Horst von Brand; +Cc: linux-kernel
Horst von Brand <vonbrand@inf.utfsm.cl> wrote:
>
> Machine is sparc64, bk of today, gcc-3.4.2-6.fc3 (Aurora Corona). First 2.6
> I try to build here, so it might be something known.
>
> Build fails due to -Werror with:
>
> include/asm/uaccess.h: In function `load_elf_binary':
> arch/sparc64/kernel/../../../fs/binfmt_elf.c:811: warning: ignoring return value of `__clear_user', declared with attribute warn_unused_result
Oh bugger.
> Around line 811 of fs/binfmt_elf.c I see:
>
> /*
> * This bss-zeroing can fail if the ELF file
> * specifies odd protections. So we don't check * the return value
> */
> (void)clear_user((void __user *)elf_bss +
> load_bias, nbyte);
>
> so presumably this discarding is OK here...
>
> I wonder why an explicit (void) cast is not considered "use" by the
> compiler. But then again, explicitly throwing away isn't really "use"...
I'd assumed that it would work. How about this?
--- 25/fs/binfmt_elf.c~binfmt_elf-build-fix Wed Feb 23 16:52:48 2005
+++ 25-akpm/fs/binfmt_elf.c Wed Feb 23 16:53:40 2005
@@ -821,13 +821,14 @@ static int load_elf_binary(struct linux_
nbyte = ELF_MIN_ALIGN - nbyte;
if (nbyte > elf_brk - elf_bss)
nbyte = elf_brk - elf_bss;
- /*
- * This bss-zeroing can fail if the ELF file
- * specifies odd protections. So we don't check
- * the return value
- */
- (void)clear_user((void __user *)elf_bss +
- load_bias, nbyte);
+ if (clear_user((void __user *)elf_bss +
+ load_bias, nbyte)) {
+ /*
+ * This bss-zeroing can fail if the ELF
+ * file specifies odd protections. So
+ * we don't check the return value
+ */
+ }
}
}
_
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-24 0:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-23 17:27 Ignored return value of __clear_user in fs/binfmt_elf.c? Horst von Brand
2005-02-24 0:54 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox