* [v2,03/17] compat_ioctl: use correct compat_ptr() translation in drivers
@ 2018-09-12 15:01 Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2018-09-12 15:01 UTC (permalink / raw)
To: viro
Cc: linux-fsdevel, Arnd Bergmann, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Frank Haverkamp, Guilherme G. Piccoli,
Kashyap Desai, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, linuxppc-dev, linux-kernel,
megaraidlinux.pdl, linux-scsi, linux-usb
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 generic_compat_ioctl_ptrarg
helper makes it more correct in theory, and simplifies the code.
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 43917898fb9a..acd362498f8c 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 = generic_compat_ioctl_ptrarg,
.release = device_close,
};
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index f453ab82f0d7..6e73df9b3788 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -1220,34 +1220,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 = generic_compat_ioctl_ptrarg,
.release = genwqe_release,
};
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index 8428247015db..00daa1547783 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 = generic_compat_ioctl_ptrarg,
.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);
@@ -1233,25 +1226,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 3ada83d81bda..f4af64b4cb36 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1276,14 +1276,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,
@@ -1292,9 +1284,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 = generic_compat_ioctl_ptrarg,
};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [v2,03/17] compat_ioctl: use correct compat_ptr() translation in drivers
@ 2018-09-12 18:13 Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-12 18:13 UTC (permalink / raw)
To: Arnd Bergmann
Cc: viro, linux-fsdevel, Frederic Barrat, Andrew Donnellan,
Frank Haverkamp, Guilherme G. Piccoli, Kashyap Desai,
Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, linuxppc-dev, linux-kernel,
megaraidlinux.pdl, linux-scsi, linux-usb
On Wed, Sep 12, 2018 at 05:01:04PM +0200, Arnd Bergmann wrote:
> 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 generic_compat_ioctl_ptrarg
> helper makes it more correct in theory, and simplifies the code.
>
> 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(-)
Nice cleanup on this series!
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v2,03/17] compat_ioctl: use correct compat_ptr() translation in drivers
@ 2018-09-13 0:48 Andrew Donnellan
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Donnellan @ 2018-09-13 0:48 UTC (permalink / raw)
To: Arnd Bergmann, viro
Cc: linux-fsdevel, Frederic Barrat, Greg Kroah-Hartman,
Frank Haverkamp, Guilherme G. Piccoli, Kashyap Desai,
Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen, Felipe Balbi, linuxppc-dev, linux-kernel,
megaraidlinux.pdl, linux-scsi, linux-usb
On 13/09/18 01:01, Arnd Bergmann wrote:
> 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 generic_compat_ioctl_ptrarg
> helper makes it more correct in theory, and simplifies the code.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
For cxl:
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v2,03/17] compat_ioctl: use correct compat_ptr() translation in drivers
@ 2018-09-13 11:03 Felipe Balbi
0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2018-09-13 11:03 UTC (permalink / raw)
To: Arnd Bergmann, viro
Cc: linux-fsdevel, Frederic Barrat, Andrew Donnellan,
Greg Kroah-Hartman, Frank Haverkamp, Guilherme G. Piccoli,
Kashyap Desai, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen, linuxppc-dev, linux-kernel, megaraidlinux.pdl,
linux-scsi, linux-usb
Arnd Bergmann <arnd@arndb.de> writes:
> 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 generic_compat_ioctl_ptrarg
> helper makes it more correct in theory, and simplifies the code.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-13 11:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-12 18:13 [v2,03/17] compat_ioctl: use correct compat_ptr() translation in drivers Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2018-09-13 11:03 Felipe Balbi
2018-09-13 0:48 Andrew Donnellan
2018-09-12 15:01 Arnd Bergmann
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).