Commit 8c2348e3 authored by Al Viro's avatar Al Viro

atm: separate ATM_GETNAMES handling from the rest of atm_dev_ioctl()

atm_dev_ioctl() does copyin in two different ways - one for
ATM_GETNAMES, another for everything else.  Start with separating
the former into a new helper (atm_getnames()).  The next step
will be to lift the copyin into the callers.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 38c53ca3
......@@ -162,7 +162,11 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
if (error != -ENOIOCTLCMD)
goto done;
if (cmd == ATM_GETNAMES) {
error = atm_getnames(argp, compat);
} else {
error = atm_dev_ioctl(cmd, argp, compat);
}
done:
return error;
......
......@@ -193,18 +193,15 @@ static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg,
return error ? -EFAULT : 0;
}
int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
int atm_getnames(void __user *arg, int compat)
{
void __user *buf;
int error, len, number, size = 0;
int error, len, size = 0;
struct atm_dev *dev;
struct list_head *p;
int *tmp_buf, *tmp_p;
int __user *sioc_len;
int __user *iobuf_len;
switch (cmd) {
case ATM_GETNAMES:
if (IS_ENABLED(CONFIG_COMPAT) && compat) {
#ifdef CONFIG_COMPAT
struct compat_atm_iobuf __user *ciobuf = arg;
......@@ -245,9 +242,14 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
? -EFAULT : 0;
kfree(tmp_buf);
return error;
default:
break;
}
}
int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
{
void __user *buf;
int error, len, number, size = 0;
struct atm_dev *dev;
int __user *sioc_len;
if (IS_ENABLED(CONFIG_COMPAT) && compat) {
#ifdef CONFIG_COMPAT
......
......@@ -14,6 +14,7 @@
extern struct list_head atm_devs;
extern struct mutex atm_dev_mutex;
int atm_getnames(void __user *arg, int compat);
int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment