diff options
Diffstat (limited to 'src/lib/cbfs.c')
-rw-r--r-- | src/lib/cbfs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 400b8a5f9d..f48d887d87 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -268,8 +268,6 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name) name, (uint32_t) stage->load, stage->memlen, stage->entry); - /* Stages rely the below clearing so that the bss is initialized. */ - memset((void *) (uint32_t) stage->load, 0, stage->memlen); final_size = cbfs_decompress(stage->compression, ((unsigned char *) stage) + @@ -279,6 +277,10 @@ void * cbfs_load_stage(struct cbfs_media *media, const char *name) if (!final_size) return (void *) -1; + /* Stages rely the below clearing so that the bss is initialized. */ + memset((void *)((uintptr_t)stage->load + final_size), 0, + stage->memlen - final_size); + DEBUG("stage loaded.\n"); entry = stage->entry; |