summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-09-23 14:21:06 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-09-23 14:21:06 +0000
commit8268fdb90227af0293d2fbfcf92f971af44cb001 (patch)
tree4a5f50d844a729a5806abfed35e79169ca9fd6d2 /flashrom.c
parenta6a0d2000a1197e90faaf8d9e7697c96f1deb934 (diff)
downloadast2050-flashrom-8268fdb90227af0293d2fbfcf92f971af44cb001.zip
ast2050-flashrom-8268fdb90227af0293d2fbfcf92f971af44cb001.tar.gz
layout: Verify layout entries before building a new image using them
This fixes a SEGFAULT if a layout entry is included that addresses memory outside the current chip's address range. flashrom will only abort if the offending region(s) is/are included else it will just warn. It will print warnings for regions with negative or zero-length address ranges and bail out after checking all of them. Also, abort for non-write operations if a layout file is given because there is no layout support for other operations yet. Corresponding to flashrom svn r1751. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/flashrom.c b/flashrom.c
index 9169620..afab57c 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1916,6 +1916,12 @@ int doit(struct flashctx *flash, int force, const char *filename, int read_it,
goto out_nofree;
}
+ if (normalize_romentries(flash)) {
+ msg_cerr("Requested regions can not be handled. Aborting.\n");
+ ret = 1;
+ goto out_nofree;
+ }
+
/* Given the existence of read locks, we want to unlock for read,
* erase and write.
*/
@@ -1995,9 +2001,8 @@ int doit(struct flashctx *flash, int force, const char *filename, int read_it,
}
msg_cinfo("done.\n");
- // This should be moved into each flash part's code to do it
- // cleanly. This does the job.
- handle_romentries(flash, oldcontents, newcontents);
+ /* Build a new image taking the given layout into account. */
+ build_new_image(flash, oldcontents, newcontents);
// ////////////////////////////////////////////////////////////
OpenPOWER on IntegriCloud