diff options
author | Stefan Reinauer <stepan@coresystems.de> | 2009-09-22 15:55:01 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2009-09-22 15:55:01 +0000 |
commit | 853270af390f9e200f4a165ec55d3b2fa5246c0b (patch) | |
tree | 6567b87c2f645a5c0c29b39c277f1b5de95f19a3 /util/cbfstool/common.h | |
parent | 0e0655e6ef815524107481856e40266ba23248f1 (diff) | |
download | coreboot-853270af390f9e200f4a165ec55d3b2fa5246c0b.tar.xz |
* guard all mallocs in cbfstool
* fix an issue that could lead to cbfstool writing outside of its allocated
memory
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4653 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/common.h')
-rw-r--r-- | util/cbfstool/common.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h index 944f215b5d..a41eb8a439 100644 --- a/util/cbfstool/common.h +++ b/util/cbfstool/common.h @@ -29,7 +29,7 @@ static void *phys_to_virt(uint32_t addr) static uint32_t virt_to_phys(void *addr) { - return (long)(addr - offset) & 0xffffffff; + return (unsigned long)(addr - offset) & 0xffffffff; } #define ALIGN(val, by) (((val) + (by)-1)&~((by)-1)) @@ -61,3 +61,5 @@ int create_cbfs_image(const char *romfile, uint32_t romsize, int add_file_to_cbfs(void *content, uint32_t contentsize, uint32_t location); void print_cbfs_directory(const char *filename); + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |