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


Groups > linux.kernel > #1304239 > unrolled thread

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

Started byBamvor Jian Zhang <bamvor.zhangjian@linaro.org>
First post2016-01-08 09:00 +0100
Last post2016-01-08 09:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 2/3] ppdev: add support for compat ioctl Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> - 2016-01-08 09:00 +0100

#1304239 — [PATCH v4 2/3] ppdev: add support for compat ioctl

FromBamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Date2016-01-08 09:00 +0100
Subject[PATCH v4 2/3] ppdev: add support for compat ioctl
Message-ID<qOA7M-3BQ-5@gated-at.bofh.it>
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>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/char/ppdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index c03d998..9e98d01 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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web