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


Groups > linux.kernel > #1293717

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

From Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v2 2/2] ppdev: add support for compat ioctl
Date 2015-12-17 11:00 +0100
Message-ID <qGDvQ-62G-17@gated-at.bofh.it> (permalink)
References <qGDvP-62G-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The arg of ioctl in ppdev is the pointer of integer except the
timeval in PPSETTIME, PPGETTIME. Different size of timeval
is already supported by the previous patches. So, it is safe
to add compat support.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
---
 drivers/char/ppdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 19a4d6e..31bc7b7 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -69,6 +69,7 @@
 #include <linux/ppdev.h>
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
+#include <linux/compat.h>
 
 #define PP_VERSION "ppdev: user-space parallel port driver"
 #define CHRDEV "ppdev"
@@ -670,6 +671,14 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	return ret;
 }
 
+#ifdef CONFIG_COMPAT
+static long pp_compat_ioctl(struct file *file, unsigned int cmd,
+		unsigned long arg)
+{
+	return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 static int pp_open (struct inode * inode, struct file * file)
 {
 	unsigned int minor = iminor(inode);
@@ -779,6 +788,9 @@ static const struct file_operations pp_fops = {
 	.write		= pp_write,
 	.poll		= pp_poll,
 	.unlocked_ioctl	= pp_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl   = pp_compat_ioctl,
+#endif
 	.open		= pp_open,
 	.release	= pp_release,
 };
-- 
2.1.4

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