All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: y2038@lists.linaro.org, gregkh@linuxfoundation.org,
	arnd@arndb.de, sudipm.mukherjee@gmail.com, broonie@kernel.org,
	Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Subject: [PATCH v2 2/2] ppdev: add support for compat ioctl
Date: Thu, 17 Dec 2015 17:58:52 +0800	[thread overview]
Message-ID: <1450346332-31830-3-git-send-email-bamvor.zhangjian@linaro.org> (raw)
In-Reply-To: <1450346332-31830-1-git-send-email-bamvor.zhangjian@linaro.org>

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


  parent reply	other threads:[~2015-12-17  9:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17  9:58 [PATCH v2 0/2] Convert ppdev to y2038 safe Bamvor Jian Zhang
2015-12-17  9:58 ` [PATCH v2 1/2] ppdev: convert " Bamvor Jian Zhang
2015-12-17  9:58 ` Bamvor Jian Zhang [this message]
2015-12-17 23:12   ` [PATCH v2 2/2] ppdev: add support for compat ioctl Arnd Bergmann
2015-12-30 11:16     ` Sudip Mukherjee
2015-12-30 13:24       ` Bamvor Jian Zhang
2015-12-30 13:48         ` Sudip Mukherjee
2015-12-30 13:51         ` [Y2038] " Arnd Bergmann
2015-12-30 14:20           ` Bamvor Jian Zhang
2015-12-31  9:43             ` Sudip Mukherjee
2015-12-31 14:12               ` Arnd Bergmann
2016-01-01  5:04                 ` Sudip Mukherjee
2016-01-01 22:09                   ` Arnd Bergmann
2016-01-02  6:29                     ` Sudip Mukherjee
2016-01-02 22:40                       ` Arnd Bergmann
2016-01-04 13:14                         ` Sudip Mukherjee
2016-01-04 13:26                           ` Arnd Bergmann
2016-01-06 12:56                           ` Bamvor Jian Zhang
2016-01-07 15:12                             ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450346332-31830-3-git-send-email-bamvor.zhangjian@linaro.org \
    --to=bamvor.zhangjian@linaro.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.