提交 16e1a577 编写于 作者: H Heiko Carstens 提交者: Martin Schwidefsky

[S390] fs3270: add missing compat ptr conversion

Add missing compat ptr conversion including two additional
whitespace changes that aren't worth a separate patch.
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 8f3eabe3
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <asm/compat.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/cio.h> #include <asm/cio.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
...@@ -322,6 +323,7 @@ fs3270_write(struct file *filp, const char __user *data, size_t count, loff_t *o ...@@ -322,6 +323,7 @@ fs3270_write(struct file *filp, const char __user *data, size_t count, loff_t *o
static long static long
fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ {
char __user *argp;
struct fs3270 *fp; struct fs3270 *fp;
struct raw3270_iocb iocb; struct raw3270_iocb iocb;
int rc; int rc;
...@@ -329,6 +331,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -329,6 +331,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
fp = filp->private_data; fp = filp->private_data;
if (!fp) if (!fp)
return -ENODEV; return -ENODEV;
if (is_compat_task())
argp = compat_ptr(arg);
else
argp = (char __user *)arg;
rc = 0; rc = 0;
mutex_lock(&fs3270_mutex); mutex_lock(&fs3270_mutex);
switch (cmd) { switch (cmd) {
...@@ -339,10 +345,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -339,10 +345,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
fp->write_command = arg; fp->write_command = arg;
break; break;
case TUBGETI: case TUBGETI:
rc = put_user(fp->read_command, (char __user *) arg); rc = put_user(fp->read_command, argp);
break; break;
case TUBGETO: case TUBGETO:
rc = put_user(fp->write_command,(char __user *) arg); rc = put_user(fp->write_command, argp);
break; break;
case TUBGETMOD: case TUBGETMOD:
iocb.model = fp->view.model; iocb.model = fp->view.model;
...@@ -351,8 +357,7 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -351,8 +357,7 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
iocb.pf_cnt = 24; iocb.pf_cnt = 24;
iocb.re_cnt = 20; iocb.re_cnt = 20;
iocb.map = 0; iocb.map = 0;
if (copy_to_user((char __user *) arg, &iocb, if (copy_to_user(argp, &iocb, sizeof(struct raw3270_iocb)))
sizeof(struct raw3270_iocb)))
rc = -EFAULT; rc = -EFAULT;
break; break;
} }
...@@ -511,8 +516,8 @@ static const struct file_operations fs3270_fops = { ...@@ -511,8 +516,8 @@ static const struct file_operations fs3270_fops = {
.write = fs3270_write, /* write */ .write = fs3270_write, /* write */
.unlocked_ioctl = fs3270_ioctl, /* ioctl */ .unlocked_ioctl = fs3270_ioctl, /* ioctl */
.compat_ioctl = fs3270_ioctl, /* ioctl */ .compat_ioctl = fs3270_ioctl, /* ioctl */
.open = fs3270_open, /* open */ .open = fs3270_open, /* open */
.release = fs3270_close, /* release */ .release = fs3270_close, /* release */
}; };
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册