Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bamvor Jian Zhang and committed by
Greg Kroah-Hartman
17a3596f 3b9ab374

+12
+12
drivers/char/ppdev.c
··· 69 69 #include <linux/ppdev.h> 70 70 #include <linux/mutex.h> 71 71 #include <linux/uaccess.h> 72 + #include <linux/compat.h> 72 73 73 74 #define PP_VERSION "ppdev: user-space parallel port driver" 74 75 #define CHRDEV "ppdev" ··· 671 670 return ret; 672 671 } 673 672 673 + #ifdef CONFIG_COMPAT 674 + static long pp_compat_ioctl(struct file *file, unsigned int cmd, 675 + unsigned long arg) 676 + { 677 + return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); 678 + } 679 + #endif 680 + 674 681 static int pp_open (struct inode * inode, struct file * file) 675 682 { 676 683 unsigned int minor = iminor(inode); ··· 788 779 .write = pp_write, 789 780 .poll = pp_poll, 790 781 .unlocked_ioctl = pp_ioctl, 782 + #ifdef CONFIG_COMPAT 783 + .compat_ioctl = pp_compat_ioctl, 784 + #endif 791 785 .open = pp_open, 792 786 .release = pp_release, 793 787 };