mtdpart.c (79e24da00b1137031245f3341828e4215b1b5b59) mtdpart.c (29f1058a90b319b01c4cf469720e0350212d5c9c)
1/*
2 * Simple MTD partitioning layer
3 *
4 * Copyright © 2000 Nicolas Pitre <nico@fluxnic.net>
5 * Copyright © 2002 Thomas Gleixner <gleixner@linutronix.de>
6 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

121
122 /*
123 * If OOB is also requested, make sure that we do not read past the end
124 * of this partition.
125 */
126 if (ops->oobbuf) {
127 size_t len, pages;
128
1/*
2 * Simple MTD partitioning layer
3 *
4 * Copyright © 2000 Nicolas Pitre <nico@fluxnic.net>
5 * Copyright © 2002 Thomas Gleixner <gleixner@linutronix.de>
6 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

121
122 /*
123 * If OOB is also requested, make sure that we do not read past the end
124 * of this partition.
125 */
126 if (ops->oobbuf) {
127 size_t len, pages;
128
129 if (ops->mode == MTD_OPS_AUTO_OOB)
130 len = mtd->oobavail;
131 else
132 len = mtd->oobsize;
129 len = mtd_oobavail(mtd, ops);
133 pages = mtd_div_by_ws(mtd->size, mtd);
134 pages -= mtd_div_by_ws(from, mtd);
135 if (ops->ooboffs + ops->ooblen > pages * len)
136 return -EINVAL;
137 }
138
139 res = part->master->_read_oob(part->master, from + part->offset, ops);
140 if (unlikely(res)) {

--- 717 unchanged lines hidden ---
130 pages = mtd_div_by_ws(mtd->size, mtd);
131 pages -= mtd_div_by_ws(from, mtd);
132 if (ops->ooboffs + ops->ooblen > pages * len)
133 return -EINVAL;
134 }
135
136 res = part->master->_read_oob(part->master, from + part->offset, ops);
137 if (unlikely(res)) {

--- 717 unchanged lines hidden ---