mtd: cmdlinepart: allow small partitions

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 6 10:59:05 PST 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d855d23b56a5d67a7727dc275a86aaba290d7c55
Commit:     d855d23b56a5d67a7727dc275a86aaba290d7c55
Parent:     adf508c347c3a5d66d7610412467e2a03924485b
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Fri Jun 19 13:10:06 2015 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Sep 28 18:37:31 2015 -0700

    mtd: cmdlinepart: allow small partitions
    
    I'm not sure why we have a PAGE_SIZE restriction on this partition
    parser.
    
    If we really wanted the restriction, I would expect it to be a
    restriction for *all* parsers, so we'd move it to the MTD core
    
    At any rate, while small partitions may not be useful (they'll often be
    smaller than the eraseblock size and therefore can only be used
    read-only), they still have use as a read-only partition.
    
    This restriction is especially annoying because it aborts the entire
    MTD's cmdline parsing, leaving it unpartitioned.
    
    So, let's kill the restriction and only check for zero-sized partitions,
    which I expect we don't want to allow.
    
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/cmdlinepart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
index c850300..477923a 100644
--- a/drivers/mtd/cmdlinepart.c
+++ b/drivers/mtd/cmdlinepart.c
@@ -115,9 +115,8 @@ static struct mtd_partition * newpart(char *s,
 		s++;
 	} else {
 		size = memparse(s, &s);
-		if (size < PAGE_SIZE) {
-			printk(KERN_ERR ERRP "partition size too small (%llx)\n",
-			       size);
+		if (!size) {
+			printk(KERN_ERR ERRP "partition has size 0\n");
 			return ERR_PTR(-EINVAL);
 		}
 	}



More information about the linux-mtd-cvs mailing list