lkml.org 
[lkml]   [2004]   [Aug]   [31]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 31 Aug 2004 02:26:56 -0400
FromJakub Jelinek <>
SubjectRe: [PATCH] waitid system call
On Mon, Aug 30, 2004 at 11:04:46PM -0700, Roland McGrath wrote:
> +			/*> +			 * For a WNOHANG return, clear out all the fields
> +			 * we would set so the user can easily tell the
> +			 * difference.> +			 */> +			if (!retval)> +				retval = put_user(0, &infop->si_signo);
> +			if (!retval)> +				retval = put_user(0, &infop->si_errno);
> +			if (!retval)> +				retval = put_user(0, &infop->si_code);> +			if (!retval)> +				retval = put_user(0, &infop->si_pid);> +			if (!retval)> +				retval = put_user(0, &infop->si_uid);> +			if (!retval)> +				retval = put_user(0, &infop->si_status);

Is it really necessary to check the exit code after each put_user?
	if (!retval && access_ok(VERIFY_WRITE, infop, sizeof(*infop)))) {
		retval = __put_user(0, &infop->si_signo);
		retval |= __put_user(0, &infop->si_errno);
		retval |= __put_user(0, &infop->si_code);
		retval |= __put_user(0, &infop->si_pid);
		retval |= __put_user(0, &infop->si_uid);
		retval |= __put_user(0, &infop->si_status);
	}
is what kernel usually does when filling multiple structure members.
	Jakub
-
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:05    [from the cache]
©2003-2008