mtdchar.c (cd621274b0ec747db8dedbf857624c067f481976) mtdchar.c (dac2639f9833e858139d7e07f6ee45fb2191a9f2)
1/*
2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 438 unchanged lines hidden (view full) ---

447{
448 struct mtd_file_info *mfi = file->private_data;
449 struct mtd_oob_ops ops;
450 int ret = 0;
451
452 if (length > 4096)
453 return -EINVAL;
454
1/*
2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 438 unchanged lines hidden (view full) ---

447{
448 struct mtd_file_info *mfi = file->private_data;
449 struct mtd_oob_ops ops;
450 int ret = 0;
451
452 if (length > 4096)
453 return -EINVAL;
454
455 if (!mtd->read_oob)
456 ret = -EOPNOTSUPP;
457 else
458 ret = access_ok(VERIFY_WRITE, ptr,
459 length) ? 0 : -EFAULT;
460 if (ret)
461 return ret;
455 if (!access_ok(VERIFY_WRITE, ptr, length))
456 return -EFAULT;
462
463 ops.ooblen = length;
464 ops.ooboffs = start & (mtd->writesize - 1);
465 ops.datbuf = NULL;
466 ops.mode = (mfi->mode == MTD_FILE_MODE_RAW) ? MTD_OPS_RAW :
467 MTD_OPS_PLACE_OOB;
468
469 if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs))

--- 818 unchanged lines hidden ---
457
458 ops.ooblen = length;
459 ops.ooboffs = start & (mtd->writesize - 1);
460 ops.datbuf = NULL;
461 ops.mode = (mfi->mode == MTD_FILE_MODE_RAW) ? MTD_OPS_RAW :
462 MTD_OPS_PLACE_OOB;
463
464 if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs))

--- 818 unchanged lines hidden ---