Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtdchar: get rid of pointless access_ok()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 0db188f9 2ff7cfe9

+1 -23
+1 -23
drivers/mtd/mtdchar.c
··· 375 375 return -EINVAL; 376 376 377 377 if (!mtd->_write_oob) 378 - ret = -EOPNOTSUPP; 379 - else 380 - ret = access_ok(VERIFY_READ, ptr, length) ? 0 : -EFAULT; 381 - 382 - if (ret) 383 - return ret; 378 + return -EOPNOTSUPP; 384 379 385 380 ops.ooblen = length; 386 381 ops.ooboffs = start & (mtd->writesize - 1); ··· 413 418 414 419 if (length > 4096) 415 420 return -EINVAL; 416 - 417 - if (!access_ok(VERIFY_WRITE, ptr, length)) 418 - return -EFAULT; 419 421 420 422 ops.ooblen = length; 421 423 ops.ooboffs = start & (mtd->writesize - 1); ··· 610 618 611 619 usr_data = (const void __user *)(uintptr_t)req.usr_data; 612 620 usr_oob = (const void __user *)(uintptr_t)req.usr_oob; 613 - if (!access_ok(VERIFY_READ, usr_data, req.len) || 614 - !access_ok(VERIFY_READ, usr_oob, req.ooblen)) 615 - return -EFAULT; 616 621 617 622 if (!mtd->_write_oob) 618 623 return -EOPNOTSUPP; ··· 651 662 struct mtd_info *mtd = mfi->mtd; 652 663 void __user *argp = (void __user *)arg; 653 664 int ret = 0; 654 - u_long size; 655 665 struct mtd_info_user info; 656 666 657 667 pr_debug("MTD_ioctl\n"); 658 - 659 - size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 660 - if (cmd & IOC_IN) { 661 - if (!access_ok(VERIFY_READ, argp, size)) 662 - return -EFAULT; 663 - } 664 - if (cmd & IOC_OUT) { 665 - if (!access_ok(VERIFY_WRITE, argp, size)) 666 - return -EFAULT; 667 - } 668 668 669 669 switch (cmd) { 670 670 case MEMGETREGIONCOUNT: