Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3532676yba; Tue, 16 Apr 2019 13:25:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhup0XK+tfJSepnoxSsl2YI8r5Cg5uXi65QwrIuDX1ub7FWWpLBxZMYkOrcy8GAmBmVtM+ X-Received: by 2002:a62:e315:: with SMTP id g21mr84605195pfh.2.1555446309255; Tue, 16 Apr 2019 13:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555446309; cv=none; d=google.com; s=arc-20160816; b=sol5B92JLmn5Wqck7xCFPV4JI4YrkbiSvJb6o5Pr2ql3yXHBAA2OKFtfimuhpIQwuu jxURdWTjhp0k/GNDHQjIDz28R/Is06VCjyPwiDA0vJDqJfN4/noCadaGwTTjNDRD9S0N VcyVK1Tw3Iac3lHCwGvg2ohMQG41Rf4owNAKS3ZCr5MNQUUww/uLRFGMn7WjTCE6k7uu Lz/Pi4rqKhV+oqxb4+NmcJ7oGH/EgzOg7OlIxBeuZ2QoCvzNMB8vzPTy1m61BtOWrD6B 5doBnN2pskeJSWl1CChXUKvjljIYYA+MMfPBBiuaR0kxNXiSsFKp9YPI5plCf4Rjkq9R 3w+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MVURSqmuBGXCMnrpbVdkB9Zu8LTlBdok0ijPvmx3x2Q=; b=qdYe1qvGzIh35wPADt0cgZs1bVtLjApDCnVgtEqNFjJ4oOeCqm20EWsnDOzmXh73vd dSziRJRuG8fBxTbdblzR2W0sEgOVkSFYV49dxXePvUhDad41Z+LZPGOWeDa4uDSO2XCR +ebWVRwvrwmX1Bi0ysd1Zm4miNfCfqjWhxnnmYIOC/D8VslDZcpy1UCPKm6m75TwqNUZ ADxJV+NTuFhuMu0vNRBi3f6lAw0jJUpShLvt49slN7mgnHHSmyDTqJOXfw60anSNg+sJ IiWAThgWjJ+G+0jlrcHg7fdsdVaXwXRN/fXLYHchiVqui9pTMiDTmgHapWgcyEcEXiJ8 jgOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si49791719pgk.405.2019.04.16.13.24.53; Tue, 16 Apr 2019 13:25:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730822AbfDPUWs (ORCPT + 99 others); Tue, 16 Apr 2019 16:22:48 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:54037 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730472AbfDPUWs (ORCPT ); Tue, 16 Apr 2019 16:22:48 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MYLqs-1hKMVj2DQ2-00VROG; Tue, 16 Apr 2019 22:22:29 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Andrew Donnellan , Felipe Balbi , Frederic Barrat , Frank Haverkamp , Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Jerry Zhang , Vincent Pelletier , Andrzej Pietrasiewicz , Shen Jing , linuxppc-dev@lists.ozlabs.org, megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v3 10/26] compat_ioctl: use correct compat_ptr() translation in drivers Date: Tue, 16 Apr 2019 22:19:48 +0200 Message-Id: <20190416202013.4034148-11-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190416202013.4034148-1-arnd@arndb.de> References: <20190416202013.4034148-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:dhXxVwlF+OTv8zTau2mq8cW9se+5+L4XB4D+BXwtDLVtt1eHtvH 9j0eCYXXgpxChG2e+3m5sp1o66pwBmHIM2FHcEPi9zE0BZKkLHbZNmHnn2+GcU+w9KKJ0Xr +OSW2NH8h1S951PFymOn/9mrd2neAmTVkxmgkRDwiI2y7EQMG12TYsIUTnf0SUxFMAktcKM /O02KIxJdbN27u4CGMA4g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:p/lEhNyfi0M=:BGMO+DqJh9KBHQtwPEOwGx ZvFHFvMvfly9/nfku2neA5EJJ0wA/7lYo2R92uQbDZ4RSunLr4T3lNgvwy8J2miL4ONveNol0 NO0TBQCQ+Kv4Lr9VnORrI9XV8IR9huTtI9Kkz+kuzHZWlivbFJwQxgX7hGtYwV3fJxnY1rWn3 1UYFA/0oowmuOdzjvn1K8BEwz2lOGQz/TMc+yv5UuJQ2v3iaXL8fqpOg7oM/SGBngGL9Zq3QJ 76Lo3SUQuBgoBwW3vyukwEHw363Va2GXlPbbF4mPDzOGRpDBunS1ghS2gYU9ZjTbDlc6FHtDf XuZCgJ1WkglsDHhbegTdCIgzhRz9CY8MLOarplHlUkrqVjxKIo+EQDw3rlUWdxSIjutMjadMp Q5d+sYXmL5nxc41yjTr6IEy+FRb8M/gFRpiCrqHKh6lV7IF6OwfDFLuXN64Od+s/YCQ4yze1S 4NGTx3sJiDXUXsY0G7E+ne1X2DSfvtoF6PbZzOcWGUvYNKcz6GzPB9eoA4hgO5JXXgu8OP4GH 9mvOERN3xpBwk409vs3LKwMiNar3EdDF75tVcEQEzX8WPIJ+deJwS44rhZ4pSp8usbPjrGC8c EsfY+Ftfu9ngwxbRw5lLYuN8AsTEl/BSELPDew5KLKLNBkfVq54qhM3qs654jfrPJyWhnArQN FRh2ekxvl5xRzxrw9VCHRmLcdkyamf/BKexhZefiopdVuK7TmkF3IyUBtt1Tbrr4LAmGWj4Rv 60qC4WULwufY42ykZcHrTiyfzlUZFbScqwLLkA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A handful of drivers all have a trivial wrapper around their ioctl handler, but don't call the compat_ptr() conversion function at the moment. In practice this does not matter, since none of them are used on the s390 architecture and for all other architectures, compat_ptr() does not do anything, but using the new compat_ptr_ioctl() helper makes it more correct in theory, and simplifies the code. Acked-by: Greg Kroah-Hartman Acked-by: Andrew Donnellan Acked-by: Felipe Balbi Signed-off-by: Arnd Bergmann --- drivers/misc/cxl/flash.c | 8 +------- drivers/misc/genwqe/card_dev.c | 23 +---------------------- drivers/scsi/megaraid/megaraid_mm.c | 28 +--------------------------- drivers/usb/gadget/function/f_fs.c | 12 +----------- 4 files changed, 4 insertions(+), 67 deletions(-) diff --git a/drivers/misc/cxl/flash.c b/drivers/misc/cxl/flash.c index 4d6836f19489..cb9cca35a226 100644 --- a/drivers/misc/cxl/flash.c +++ b/drivers/misc/cxl/flash.c @@ -473,12 +473,6 @@ static long device_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return -EINVAL; } -static long device_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return device_ioctl(file, cmd, arg); -} - static int device_close(struct inode *inode, struct file *file) { struct cxl *adapter = file->private_data; @@ -514,7 +508,7 @@ static const struct file_operations fops = { .owner = THIS_MODULE, .open = device_open, .unlocked_ioctl = device_ioctl, - .compat_ioctl = device_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .release = device_close, }; diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 8c1b63a4337b..5de0796f2786 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -1221,34 +1221,13 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd, return rc; } -#if defined(CONFIG_COMPAT) -/** - * genwqe_compat_ioctl() - Compatibility ioctl - * - * Called whenever a 32-bit process running under a 64-bit kernel - * performs an ioctl on /dev/genwqe_card. - * - * @filp: file pointer. - * @cmd: command. - * @arg: user argument. - * Return: zero on success or negative number on failure. - */ -static long genwqe_compat_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) -{ - return genwqe_ioctl(filp, cmd, arg); -} -#endif /* defined(CONFIG_COMPAT) */ - static const struct file_operations genwqe_fops = { .owner = THIS_MODULE, .open = genwqe_open, .fasync = genwqe_fasync, .mmap = genwqe_mmap, .unlocked_ioctl = genwqe_ioctl, -#if defined(CONFIG_COMPAT) - .compat_ioctl = genwqe_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .release = genwqe_release, }; diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 3ce837e4b24c..21ee5751c04e 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -45,10 +45,6 @@ static int mraid_mm_setup_dma_pools(mraid_mmadp_t *); static void mraid_mm_free_adp_resources(mraid_mmadp_t *); static void mraid_mm_teardown_dma_pools(mraid_mmadp_t *); -#ifdef CONFIG_COMPAT -static long mraid_mm_compat_ioctl(struct file *, unsigned int, unsigned long); -#endif - MODULE_AUTHOR("LSI Logic Corporation"); MODULE_DESCRIPTION("LSI Logic Management Module"); MODULE_LICENSE("GPL"); @@ -72,9 +68,7 @@ static wait_queue_head_t wait_q; static const struct file_operations lsi_fops = { .open = mraid_mm_open, .unlocked_ioctl = mraid_mm_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = mraid_mm_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .owner = THIS_MODULE, .llseek = noop_llseek, }; @@ -228,7 +222,6 @@ mraid_mm_unlocked_ioctl(struct file *filep, unsigned int cmd, { int err; - /* inconsistent: mraid_mm_compat_ioctl doesn't take the BKL */ mutex_lock(&mraid_mm_mutex); err = mraid_mm_ioctl(filep, cmd, arg); mutex_unlock(&mraid_mm_mutex); @@ -1232,25 +1225,6 @@ mraid_mm_init(void) } -#ifdef CONFIG_COMPAT -/** - * mraid_mm_compat_ioctl - 32bit to 64bit ioctl conversion routine - * @filep : file operations pointer (ignored) - * @cmd : ioctl command - * @arg : user ioctl packet - */ -static long -mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, - unsigned long arg) -{ - int err; - - err = mraid_mm_ioctl(filep, cmd, arg); - - return err; -} -#endif - /** * mraid_mm_exit - Module exit point */ diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 20413c276c61..addc210d198a 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1347,14 +1347,6 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, return ret; } -#ifdef CONFIG_COMPAT -static long ffs_epfile_compat_ioctl(struct file *file, unsigned code, - unsigned long value) -{ - return ffs_epfile_ioctl(file, code, value); -} -#endif - static const struct file_operations ffs_epfile_operations = { .llseek = no_llseek, @@ -1363,9 +1355,7 @@ static const struct file_operations ffs_epfile_operations = { .read_iter = ffs_epfile_read_iter, .release = ffs_epfile_release, .unlocked_ioctl = ffs_epfile_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ffs_epfile_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; -- 2.20.0