Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934454AbdCJXVB (ORCPT ); Fri, 10 Mar 2017 18:21:01 -0500 Received: from mail-pg0-f54.google.com ([74.125.83.54]:36660 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934307AbdCJXUz (ORCPT ); Fri, 10 Mar 2017 18:20:55 -0500 From: Matt Ranostay To: linux-kernel@vger.kernel.org Cc: Matt Ranostay , Greg Kroah-Hartman Subject: [PATCH RESEND 1/2] pps: add ioctl_compat function to correct ioctl definitions Date: Fri, 10 Mar 2017 15:19:44 -0800 Message-Id: <20170310231945.16684-2-matt.ranostay@konsulko.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170310231945.16684-1-matt.ranostay@konsulko.com> References: <20170310231945.16684-1-matt.ranostay@konsulko.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1439 Lines: 45 ioctl definitions use the pointer size of the architecture which is fine when userspace and kernel are the same bitsize. This patchset workarounds an issue with mixed bitsize kernel + userspace by rewriting the cmd to the kernelspace architecture pointer size. Cc: Greg Kroah-Hartman Acked-by: Rodolfo Giometti Signed-off-by: Matt Ranostay --- drivers/pps/pps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c index 2f07cd615665..452ead5a5e52 100644 --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c @@ -242,6 +242,18 @@ static long pps_cdev_ioctl(struct file *file, return 0; } +#ifdef CONFIG_COMPAT +static long pps_cdev_compat_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + cmd = _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(void *)); + + return pps_cdev_ioctl(file, cmd, arg); +} +#else +#define pps_cdev_compat_ioctl NULL +#endif + static int pps_cdev_open(struct inode *inode, struct file *file) { struct pps_device *pps = container_of(inode->i_cdev, @@ -268,6 +280,7 @@ static const struct file_operations pps_cdev_fops = { .llseek = no_llseek, .poll = pps_cdev_poll, .fasync = pps_cdev_fasync, + .compat_ioctl = pps_cdev_compat_ioctl, .unlocked_ioctl = pps_cdev_ioctl, .open = pps_cdev_open, .release = pps_cdev_release, -- 2.10.2