lkml.org 
[lkml]   [2004]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: attribute warn_unused_result
On Tue, 7 Sep 2004, Con Kolivas wrote:

> Date: Tue, 7 Sep 2004 14:43:51 +0200
> From: Con Kolivas <kernel@kolivas.org>
> To: arjanv@redhat.com
> Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>,
> Andrew Morton <akpm@osdl.org>
> Subject: Re: attribute warn_unused_result
>
> Arjan van de Ven wrote:
> > On Tue, 2004-09-07 at 14:23, Con Kolivas wrote:
> >
> >>Gcc3.4.1 has recently been complaining of a number of unused results
> >>from function with attribute warn_unused_result set. I'm not sure of
> how
> >>you want to tackle this so I'm avoiding posting patches. Should we
> >>remove the attribute (seems the likely option) or set some dummy
> >>variable (sounds stupid now that I ask it).
> >
> >
> > that attribute is supposed to only be set for functions you really
> ought
> > to check the result for.... so how about checking/using the result ?
> I understand the concept... these are functions that seem to work fine
> without using the return value... unless of course the original coders
> aren't yet aware of that fact then I'm sorry. Here's the list just with
> my config on 2.6.9-rc1-bk13:
> fs/binfmt_elf.c: In function `padzero':
> fs/binfmt_elf.c:113: warning: ignoring return value of `clear_user',
> declared with attribute warn_unused_result
> include/asm/uaccess.h: In function `create_elf_tables':
> fs/binfmt_elf.c:175: warning: ignoring return value of `__copy_to_user',
>
> declared with attribute warn_unused_result
> fs/binfmt_elf.c:273: warning: ignoring return value of `copy_to_user',
> declared with attribute warn_unused_result
> fs/binfmt_elf.c: In function `load_elf_binary':
> fs/binfmt_elf.c:750: warning: ignoring return value of `clear_user',
> declared with attribute warn_unused_result
> fs/binfmt_elf.c: In function `fill_psinfo':
> fs/binfmt_elf.c:1216: warning: ignoring return value of
> `copy_from_user', declared with attribute warn_unused_result

Just a small FYI
I'm currently working on a patch to attempt to fix these up in
binfmt_elf.c expect that to apear on the list within ~24hrs.

copy_to_user and clear_user can fail, and if they do appropriate action
needs to be taken (probably returning a fault, a short read or similar) -
not checking the return value and not taking any action is an error as I
see it.


--
Jesper Juhl <juhl-lkml@dif.dk>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.044 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site