Messages in this thread | | | Date | Tue, 16 Sep 2003 01:26:32 -0700 | From | Andrew Morton <> | Subject | Re: Add function attribute to copy_from_user to warn for unchecked results |
| |
Arjan van de Ven <arjanv@redhat.com> wrote: > > Hi, > > gcc 3.4 (CVS) has a new function attribute (warn_unused_result) that > will make gcc spit out a warning in the event that a "marked" function's > result is ignored by the caller.
Nice.
> +/* warning: this function has no way to return -EFAULT on bad userspace access */ > static inline > void set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset) > { > + int dummy; > if (ufdset) > - __copy_to_user(ufdset, fdset, FDS_BYTES(nr)); > + dummy = __copy_to_user(ufdset, fdset, FDS_BYTES(nr)); > } >
Wouldn't it be neater to make this return the __copy_to_user() result? And to mark it __must_check? And to fix the bug you just found in sys_select()? ;) - 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/
| |