This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 13/19] y2038: add compat handling for sys_semtimedop
- From: Arnd Bergmann <arnd at arndb dot de>
- To: Thomas Gleixner <tglx at linutronix dot de>
- Cc: y2038 at lists dot linaro dot org, baolin dot wang at linaro dot org, albert dot aribaud at 3adev dot fr, john dot stultz at linaro dot org, bamvor dot zhangjian at linaro dot org, ruchandani dot tina at gmail dot com, linux-api at vger dot kernel dot org, linux-kernel at vger dot kernel dot org, libc-alpha at sourceware dot org
- Date: Sat, 16 May 2015 09:28:49 +0200
- Subject: Re: [PATCH 13/19] y2038: add compat handling for sys_semtimedop
- Authentication-results: sourceware.org; auth=none
- References: <1430929826-318934-1-git-send-email-arnd at arndb dot de> <1430929826-318934-14-git-send-email-arnd at arndb dot de> <alpine dot DEB dot 2 dot 11 dot 1505160041370 dot 4225 at nanos>
On Saturday 16 May 2015 00:46:44 Thomas Gleixner wrote:
> On Wed, 6 May 2015, Arnd Bergmann wrote:
> > +SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
> > + unsigned, nsops,
> > + const struct __kernel_timespec __user *, timeout)
> > +{
> > + unsigned long jiffies_left = 0;
> > +
> > + if (timeout) {
> > + struct timespec64 _timeout;
> > + if (get_timespec64(&_timeout, timeout))
>
> Moo. I had to look 3 times to get not confused by the extra
> underscore. What's wrong with a proper variable name which is easy to
> distinguish?
>
> > + return -EFAULT;
>
> > + if (_timeout.tv_sec < 0 || _timeout.tv_nsec < 0 ||
> > + _timeout.tv_nsec >= 1000000000L)
> > + return -EINVAL;
>
> We have proper helper functions to validate time specs.
I tried to change the existing code as little as possible, but I agree
with your points here. I'll add a cleanup patch to fix the current code
before my own patches.
Arnd