This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: bug in times.c
- From: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
- To: Petr Baudis <pasky at ucw dot cz>
- Cc: Holger Brunck <holger dot brunck at keymile dot com>, libc-alpha at sourceware dot org, "Bigler, Stefan" <Stefan dot Bigler at keymile dot com>
- Date: Mon, 11 Mar 2013 17:35:39 +0530
- Subject: Re: bug in times.c
- References: <513DB23B.6030802@keymile.com><20130311112350.GB31274@machine.or.cz>
On 11 March 2013 16:53, Petr Baudis <pasky@ucw.cz> wrote:
> - /* If we come here the memory is valid and the kernel did not
> + /* If we come here the memory is valid (or BUF is NULL, which is
> + * a valid condition for the kernel syscall) and the kernel did not
> return an EFAULT error. Return the value given by the kernel. */
Please also fix the comment above it which says:
"We crash applications which pass in an invalid BUF pointer."
to:
"We crash applications which pass in an invalid non-NULL BUF
pointer. Linux allows BUF to be NULL."
The touch() is deliberate to ensure that we don't mistake an EFAULT
for a valid return value. However, the kernel will never send us an
EFAULT if buffer is NULL, so it is safe to bypass it. The change
looks OK to me with the above modification to the comment.
Siddhesh
--
http://siddhesh.in