This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug in times.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]