Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299374

Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl
Date 2015-12-30 15:00 +0100
Message-ID <qLpse-7lJ-11@gated-at.bofh.it> (permalink)
References <qGDvP-62G-11@gated-at.bofh.it> <qLmXo-5SI-11@gated-at.bofh.it> <qLoZc-79S-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wednesday 30 December 2015 21:24:21 Bamvor Jian Zhang wrote:
> diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
> index 31bc7b7..9e98d01 100644
> --- a/drivers/char/ppdev.c
> +++ b/drivers/char/ppdev.c
> @@ -636,7 +636,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>                 if ((time32[0] < 0) || (time32[1] < 0))
>                         return -EINVAL;
>  
> -               if (copy_to_user(time32, argp, sizeof(time32)))
> +               if (copy_to_user(argp, time32, sizeof(time32)))
>                         return -EFAULT;
>  
>                 return 0;
> @@ -648,7 +648,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>                 if ((time64[0] < 0) || (time64[1] < 0))
>                         return -EINVAL;
>  
> -               if (copy_to_user(time64, argp, sizeof(time64)))
> +               if (copy_to_user(argp, time64, sizeof(time64)))
>                         return -EFAULT;
>  
>                 return 0;

This is something that would be caught by running 'make C=1' with 'sparse'
on your patch. Can you try that to see if you introduce any other warnings?

I'm guessing it's fine, but it would be nice to confirm. I also send a lot
of patches without running sparse and checkpatch first, but it's generally
a good idea.

	Arnd
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/2] Convert ppdev to y2038 safe Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> - 2015-12-17 11:00 +0100
  [PATCH v2 1/2] ppdev: convert to y2038 safe Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> - 2015-12-17 11:00 +0100
  [PATCH v2 2/2] ppdev: add support for compat ioctl Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> - 2015-12-17 11:00 +0100
    Re: [PATCH v2 2/2] ppdev: add support for compat ioctl Arnd Bergmann <arnd@arndb.de> - 2015-12-18 00:20 +0100
      Re: [PATCH v2 2/2] ppdev: add support for compat ioctl Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-30 12:20 +0100
        Re: [PATCH v2 2/2] ppdev: add support for compat ioctl Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> - 2015-12-30 14:30 +0100
          Re: [PATCH v2 2/2] ppdev: add support for compat ioctl Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-30 14:50 +0100
          Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl Arnd Bergmann <arnd@arndb.de> - 2015-12-30 15:00 +0100
            Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> - 2015-12-30 15:30 +0100
              Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-31 10:50 +0100
                Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl Arnd Bergmann <arnd@arndb.de> - 2015-12-31 15:20 +0100
                Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-01-01 06:10 +0100
                Re: [Y2038] [PATCH v2 2/2] ppdev: add support for compat ioctl Arnd Bergmann <arnd@arndb.de> - 2016-01-01 23:20 +0100

csiph-web