linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	Frederic Barrat <fbarrat@linux.ibm.com>,
	Andrew Donnellan <ajd@linux.ibm.com>,
	Frank Haverkamp <haver@linux.ibm.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linuxppc-dev@lists.ozlabs.org, megaraidlinux.pdl@broadcom.com,
	linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH v5 14/29] compat_ioctl: use correct compat_ptr() translation in drivers
Date: Tue, 30 Jul 2019 21:55:30 +0200	[thread overview]
Message-ID: <20190730195819.901457-2-arnd@arndb.de> (raw)
In-Reply-To: <20190730195819.901457-1-arnd@arndb.de>

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.

I checked that all ioctl handlers in these files are compatible
and take either pointer arguments or no argument.

Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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 0e34c0568fed..040a0bda3125 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -1215,34 +1215,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<n>_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 59cca898f088..e83163c66884 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -41,10 +41,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");
@@ -68,9 +64,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,
 };
@@ -224,7 +218,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);
@@ -1228,25 +1221,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 213ff03c8a9f..7037ec33c424 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1351,14 +1351,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,
 
@@ -1367,9 +1359,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


  reply	other threads:[~2019-07-30 19:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 19:25 [PATCH v5 00/29] compat_ioctl.c removal, part 1/3 Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 01/29] fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 02/29] FIGETBSZ: fix compat Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 03/29] compat: itanic doesn't have one Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 04/29] do_vfs_ioctl(): use saner types Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 05/29] compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 06/29] compat_sys_ioctl(): make parallel to do_vfs_ioctl() Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 07/29] ceph: fix compat_ioctl for ceph_dir_operations Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 08/29] compat_ioctl: drop FIOQSIZE table entry Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 09/29] compat_ioctl: pppoe: fix PPPOEIOCSFWD handling Arnd Bergmann
2019-07-30 21:42   ` David Miller
2019-07-30 19:25 ` [PATCH v5 10/29] compat_ioctl: add compat_ptr_ioctl() Arnd Bergmann
2019-07-30 19:25 ` [PATCH v5 11/29] compat_ioctl: move rtc handling into rtc-dev.c Arnd Bergmann
2019-07-30 19:50 ` [PATCH v5 12/29] compat_ioctl: move drivers to compat_ptr_ioctl Arnd Bergmann
2019-07-30 21:43   ` David Miller
2019-07-31  8:37   ` Cornelia Huck
2019-07-30 19:55 ` [PATCH v5 13/29] compat_ioctl: move more " Arnd Bergmann
2019-07-30 19:55   ` Arnd Bergmann [this message]
2019-07-30 19:55   ` [PATCH v5 15/29] compat_ioctl: move tape handling into drivers Arnd Bergmann
2019-07-31 10:50     ` Heiko Carstens
2019-07-31 15:47       ` Arnd Bergmann
2019-07-30 19:55   ` [PATCH v5 16/29] compat_ioctl: move ATYFB_CLK handling to atyfb driver Arnd Bergmann
2019-07-30 19:55   ` [PATCH v5 17/29] compat_ioctl: move isdn/capi ioctl translation into driver Arnd Bergmann
2019-07-30 19:55   ` [PATCH v5 18/29] compat_ioctl: move rfcomm handlers " Arnd Bergmann
2019-08-12 16:29     ` Marcel Holtmann
2019-07-30 19:55   ` [PATCH v5 19/29] compat_ioctl: move hci_sock " Arnd Bergmann
2019-08-12 16:29     ` Marcel Holtmann
2019-07-30 20:14   ` [PATCH v5 13/29] compat_ioctl: move more drivers to compat_ptr_ioctl Dan Williams
2019-07-30 20:01 ` [PATCH v5 20/29] compat_ioctl: remove HCIUART handling Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 21/29] compat_ioctl: remove HIDIO translation Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 22/29] compat_ioctl: remove translation for sound ioctls Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 23/29] compat_ioctl: remove IGNORE_IOCTL() Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 24/29] compat_ioctl: remove /dev/random commands Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 25/29] compat_ioctl: remove joystick ioctl translation Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 26/29] compat_ioctl: remove PCI " Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 27/29] compat_ioctl: remove /dev/raw " Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 28/29] compat_ioctl: remove last RAID handling code Arnd Bergmann
2019-07-30 20:01   ` [PATCH v5 29/29] compat_ioctl: remove unused convert_in_user macro 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=20190730195819.901457-2-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=ajd@linux.ibm.com \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=fbarrat@linux.ibm.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haver@linux.ibm.com \
    --cc=jejb@linux.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).