Skip to content

Commit 17a3596

Browse files
Bamvor Jian Zhanggregkh
authored andcommitted
ppdev: add support for compat ioctl
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3b9ab37 commit 17a3596

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎drivers/char/ppdev.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#include <linux/ppdev.h>
7070
#include <linux/mutex.h>
7171
#include <linux/uaccess.h>
72+
#include <linux/compat.h>
7273

7374
#define PP_VERSION "ppdev: user-space parallel port driver"
7475
#define CHRDEV "ppdev"
@@ -670,6 +671,14 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
670671
return ret;
671672
}
672673

674+
#ifdef CONFIG_COMPAT
675+
static long pp_compat_ioctl(struct file *file, unsigned int cmd,
676+
unsigned long arg)
677+
{
678+
return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
679+
}
680+
#endif
681+
673682
static int pp_open (struct inode * inode, struct file * file)
674683
{
675684
unsigned int minor = iminor(inode);
@@ -779,6 +788,9 @@ static const struct file_operations pp_fops = {
779788
.write = pp_write,
780789
.poll = pp_poll,
781790
.unlocked_ioctl = pp_ioctl,
791+
#ifdef CONFIG_COMPAT
792+
.compat_ioctl = pp_compat_ioctl,
793+
#endif
782794
.open = pp_open,
783795
.release = pp_release,
784796
};

0 commit comments

Comments
 (0)