mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-28 22:21:49 +01:00
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>
This commit is contained in:
parent
f6220f1a86
commit
2fe66dbcbc
@ -43,7 +43,7 @@ struct mrc_data_container *mrccache_find_current(struct fmap_entry *entry);
|
|||||||
* @entry: Position and size of MRC cache in SPI flash
|
* @entry: Position and size of MRC cache in SPI flash
|
||||||
* @cur: Record to write
|
* @cur: Record to write
|
||||||
* @return 0 if updated, -EEXIST if the record is the same as the latest
|
* @return 0 if updated, -EEXIST if the record is the same as the latest
|
||||||
* record, other error if SPI write failed
|
* record, -EINVAL if the record is not valid, other error if SPI write failed
|
||||||
*/
|
*/
|
||||||
int mrccache_update(struct udevice *sf, struct fmap_entry *entry,
|
int mrccache_update(struct udevice *sf, struct fmap_entry *entry,
|
||||||
struct mrc_data_container *cur);
|
struct mrc_data_container *cur);
|
||||||
|
|||||||
@ -112,6 +112,9 @@ int mrccache_update(struct udevice *sf, struct fmap_entry *entry,
|
|||||||
ulong base_addr;
|
ulong base_addr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!is_mrc_cache(cur))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* Find the last used block */
|
/* Find the last used block */
|
||||||
base_addr = (1ULL << 32) - CONFIG_ROM_SIZE + entry->offset;
|
base_addr = (1ULL << 32) - CONFIG_ROM_SIZE + entry->offset;
|
||||||
debug("Updating MRC cache data\n");
|
debug("Updating MRC cache data\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user