Skip to contentSkip to conversation

fs/* - compile warning cleanup

KJ Domen Puncer 1 participant 1 message Feb 19, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

On 15/02/05 00:02 +0200, Stephen Biggs wrote:
Content-Description: Mail message body

Quoted 16 lines

Description: compile warning cleanup - handle error return warning from clear_user - the driver writer does not want to check the return value

diff -Nurdp -X dontdiff-osdl linux-2.6.11-rc3-mm2-original/fs/binfmt_elf.c linux-2.6.11-rc3-mm2/fs/binfmt_elf.c

fs/binfmt_elf.c +2 -2
@@ -823,11 +823,16 @@ static int load_elf_binary(struct linux_
 					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
+				 * specifies odd protections, so we don't want to
+				 * check the return value. However, since clear_user() is

fs/binfmt_elf.c static int load_elf_binary(struct linux_ · line 835

Quoted 10 lines
fs/binfmt_elf.c +7 -2
+				 * declared with attribute 'warn_unused_result', this
+				 * causes a warning during compilation. Putting (void)
+				 * before the call to clear_user() doesn't silence the warning.
+				 * Thus, we need to "trick" the compiler into shutting up.
 				 */
-				(void)clear_user((void __user *)elf_bss +
-							load_bias, nbyte);
+				if (clear_user((void __user *)elf_bss +
+							load_bias, nbyte)) {
+				}

Original comment indicated (void) was there to silence gcc (which is also quiet here for original code).
Also... you added >80 chars lines.

Domen

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors