b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> |
| 2 | Date: Mon, 9 Mar 2020 08:30:19 +0100 |
| 3 | Subject: [PATCH] mtd: fix calculating partition end address |
| 4 | MIME-Version: 1.0 |
| 5 | Content-Type: text/plain; charset=UTF-8 |
| 6 | Content-Transfer-Encoding: 8bit |
| 7 | |
| 8 | This fixes check for partitions that don't start at beginning of their |
| 9 | parents. Missing partition's offset in formula could result in forcing |
| 10 | read-only incorrectly. |
| 11 | |
| 12 | Fixes: 6750f61a13a0 ("mtd: improve calculating partition boundaries when checking for alignment") |
| 13 | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> |
| 14 | --- |
| 15 | drivers/mtd/mtdpart.c | 2 +- |
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 17 | |
| 18 | --- a/drivers/mtd/mtdpart.c |
| 19 | +++ b/drivers/mtd/mtdpart.c |
| 20 | @@ -524,7 +524,7 @@ static struct mtd_part *allocate_partiti |
| 21 | part->name); |
| 22 | } |
| 23 | |
| 24 | - tmp = part_absolute_offset(parent) + slave->mtd.size; |
| 25 | + tmp = part_absolute_offset(parent) + slave->offset + slave->mtd.size; |
| 26 | remainder = do_div(tmp, wr_alignment); |
| 27 | if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { |
| 28 | slave->mtd.flags &= ~MTD_WRITEABLE; |