diff options
author | Joel Stanley <joel@jms.id.au> | 2016-11-16 13:45:35 +1030 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-12-21 16:41:50 +1100 |
commit | 7d6e73810dec029678a0d14a3f47485d4025520e (patch) | |
tree | 8c565f708e819cb3be646cef3addb84e11ded4a1 | |
parent | 3cd459766a01c1cb8334f18e93a1c8eddfc6829c (diff) | |
download | blackbird-skiboot-7d6e73810dec029678a0d14a3f47485d4025520e.tar.gz blackbird-skiboot-7d6e73810dec029678a0d14a3f47485d4025520e.zip |
arch_flash_arm: Don't assume mtd labels are short
pflash relies on arch_flash_arm parsing /proc/mtd to discover the pnor
partition. It helpfully uses strcasestr so it can handle the string
changing, which is what has happened as we moved to upstream compliant
mtd device tree bindings.
We currently have a string like this:
dev: size erasesize name
mtd0: 00060000 00001000 "u-boot"
mtd1: 00020000 00001000 "u-boot-env"
mtd2: 00280000 00001000 "kernel"
mtd3: 001c0000 00001000 "initramfs"
mtd4: 01740000 00001000 "rofs"
mtd5: 00400000 00001000 "rwfs"
mtd6: 02000000 00001000 "1e620000.flash-controller:flash@1"
mtd7: 08000000 00001000 "1e630000.flash-controller:pnor@0"
Unfortunately arch_flash_arm assumes the string will be at most 50
characters. That's right before the label we're looking for starts so
we ignore that line and keep searching.
Fix it by allowing for a 255 character line.
Fixes: 48ab7ce09504 (external/pflash: Add --mtd)
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | external/common/arch_flash_arm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/external/common/arch_flash_arm.c b/external/common/arch_flash_arm.c index bb8800ff..3cdd41de 100644 --- a/external/common/arch_flash_arm.c +++ b/external/common/arch_flash_arm.c @@ -241,7 +241,7 @@ static char *get_dev_mtd(enum flash_access access) { FILE *f; char *ret = NULL, *pos = NULL; - char line[50]; + char line[255]; if (access != BMC_MTD && access != PNOR_MTD) return NULL; |