summaryrefslogtreecommitdiffstats
path: root/arch/x86/lib
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-10-11 21:37:37 -0700
committerSimon Glass <sjg@chromium.org>2015-10-21 07:46:26 -0600
commit2fe66dbcbc1793dc199d90c4d66acaad981f9820 (patch)
treeaf1173d2071b1e13dc76f06b957a6a3529378c02 /arch/x86/lib
parentf6220f1a86109f88950fd42e3af54314de24365a (diff)
downloadblackbird-obmc-uboot-2fe66dbcbc1793dc199d90c4d66acaad981f9820.tar.gz
blackbird-obmc-uboot-2fe66dbcbc1793dc199d90c4d66acaad981f9820.zip
x86: Do sanity test on the cache record in mrccache_update()
For the cache record to write in mrccache_update(), we should perform a sanity test to see if it is a valid one. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r--arch/x86/lib/mrccache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c
index ec0d2cb18b..6dd3b5ec83 100644
--- a/arch/x86/lib/mrccache.c
+++ b/arch/x86/lib/mrccache.c
@@ -112,6 +112,9 @@ int mrccache_update(struct udevice *sf, struct fmap_entry *entry,
ulong base_addr;
int ret;
+ if (!is_mrc_cache(cur))
+ return -EINVAL;
+
/* Find the last used block */
base_addr = (1ULL << 32) - CONFIG_ROM_SIZE + entry->offset;
debug("Updating MRC cache data\n");
OpenPOWER on IntegriCloud