]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
isdn: get rid of pointless access_ok()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 4 Jun 2017 01:44:11 +0000 (21:44 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 4 Jun 2017 17:57:24 +0000 (13:57 -0400)
copy_to_user()/copy_from_user()/get_user() check themselves

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_ppp.c
drivers/isdn/isdnloop/isdnloop.c

index 9b856e1890d1ebc4f7c82ebb6b045357abe5324b..89b09c51ab7cff64d20e24ff43fff8bd720d1ef3 100644 (file)
@@ -1304,9 +1304,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                        if (arg) {
                                ulong __user *p = argp;
                                int i;
-                               if (!access_ok(VERIFY_WRITE, p,
-                                              sizeof(ulong) * ISDN_MAX_CHANNELS * 2))
-                                       return -EFAULT;
                                for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
                                        put_user(dev->ibytes[i], p++);
                                        put_user(dev->obytes[i], p++);
@@ -1540,11 +1537,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                                char __user *p = argp;
                                int i;
 
-                               if (!access_ok(VERIFY_WRITE, argp,
-                                              (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
-                                              * ISDN_MAX_CHANNELS))
-                                       return -EFAULT;
-
                                for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
                                        if (copy_to_user(p, dev->mdm.info[i].emu.profile,
                                                         ISDN_MODEM_NUMREG))
@@ -1567,11 +1559,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                                char __user *p = argp;
                                int i;
 
-                               if (!access_ok(VERIFY_READ, argp,
-                                              (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
-                                              * ISDN_MAX_CHANNELS))
-                                       return -EFAULT;
-
                                for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
                                        if (copy_from_user(dev->mdm.info[i].emu.profile, p,
                                                           ISDN_MODEM_NUMREG))
@@ -1617,8 +1604,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                                                int j = 0;
 
                                                while (1) {
-                                                       if (!access_ok(VERIFY_READ, p, 1))
-                                                               return -EFAULT;
                                                        get_user(bname[j], p++);
                                                        switch (bname[j]) {
                                                        case '\0':
@@ -1685,9 +1670,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
                                        drvidx = 0;
                                if (drvidx == -1)
                                        return -ENODEV;
-                               if (!access_ok(VERIFY_WRITE, argp,
-                                              sizeof(isdn_ioctl_struct)))
-                                       return -EFAULT;
                                c.driver = drvidx;
                                c.command = ISDN_CMD_IOCTL;
                                c.arg = cmd;
index d07dd5196ffca59c11532051fb88e2ecdc7326c9..487478bafaf5c3190f96cba4e8f69e1eb43dad3a 100644 (file)
@@ -795,9 +795,6 @@ isdn_ppp_read(int min, struct file *file, char __user *buf, int count)
        if (!(is->state & IPPP_OPEN))
                return 0;
 
-       if (!access_ok(VERIFY_WRITE, buf, count))
-               return -EFAULT;
-
        spin_lock_irqsave(&is->buflock, flags);
        b = is->first->next;
        save_buf = b->buf;
@@ -2014,9 +2011,6 @@ isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct net_device *dev)
        struct ppp_stats t;
        isdn_net_local *lp = netdev_priv(dev);
 
-       if (!access_ok(VERIFY_WRITE, res, sizeof(struct ppp_stats)))
-               return -EFAULT;
-
        /* build a temporary stat struct and copy it to user space */
 
        memset(&t, 0, sizeof(struct ppp_stats));
index ef9c8e4f1fa2900fc00ecc9adecedb7dd07a1cee..32cb0cbd7217a18adb6355f804d2f8754660c07b 100644 (file)
@@ -1142,8 +1142,6 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
                case ISDNLOOP_IOCTL_DEBUGVAR:
                        return (ulong) card;
                case ISDNLOOP_IOCTL_STARTUP:
-                       if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef)))
-                               return -EFAULT;
                        return isdnloop_start(card, (isdnloop_sdef *) a);
                        break;
                case ISDNLOOP_IOCTL_ADDCARD: