On Tuesday 26 May 2015 18:08:29 Baolin Wang wrote:
> +SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
> +               const struct itimerspec __user *, new_setting,
> +               struct itimerspec __user *, old_setting)
> +{
> +       struct itimerspec new_spec, old_spec;
> +       int error = 0;
> +       struct itimerspec *rtn = old_setting ? &old_spec : NULL;
> +
> +       if (!new_setting)
> +               return -EINVAL;
> +
> +       if (copy_from_user(&new_spec, new_setting, sizeof (new_spec)))
> +               return -EFAULT;
> +
> +       if (!timespec_valid(&new_spec.it_interval) ||
> +           !timespec_valid(&new_spec.it_value))
> +               return -EINVAL;
> +
> +       error = __timer_settime(timer_id, flags, &new_spec, rtn);
> +
>         if (old_setting && !error &&
>             copy_to_user(old_setting, &old_spec, sizeof (old_spec)))
>                 error = -EFAULT;
> 

Since this is meant as preparation for adding the compat syscalls,
I think the actual syscall code here should be as small as possible.

In order to do that, it would be better to have the timespec_valid
calls inside of __timer_settime.

        Arnd
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038

Reply via email to