From b1b5118c717d673506292dced272a0837612fc17 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 5 Mar 2014 14:54:13 -0600 Subject: cbfstool: elfheaders: use proper parameters to calloc() Though the result doesn't matter much, the callers of calloc() should order the parameters correctly. i.e. the first paramter is the number of elements in an array and the second is the size of each element. Change-Id: Ic7c2910d623d96f380feb4e5f6fa432376f49e9b Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/5371 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer Reviewed-by: Marc Jones --- util/cbfstool/elfheaders.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/cbfstool/elfheaders.c b/util/cbfstool/elfheaders.c index 0b05255204..3af82a6ce6 100644 --- a/util/cbfstool/elfheaders.c +++ b/util/cbfstool/elfheaders.c @@ -271,7 +271,7 @@ phdr_read(const struct buffer *in, Elf64_Ehdr *ehdr, struct xdr *xdr, int bit64) * We do them all at once because there is more * than one loop over all the phdrs. */ - phdr = calloc(sizeof(*phdr), ehdr->e_phnum); + phdr = calloc(ehdr->e_phnum, sizeof(*phdr)); for (i = 0; i < ehdr->e_phnum; i++) elf_phdr(&b, &phdr[i], ehdr->e_phentsize, xdr, bit64); @@ -295,7 +295,7 @@ shdr_read(const struct buffer *in, Elf64_Ehdr *ehdr, struct xdr *xdr, int bit64) return NULL; /* gather up all the shdrs. */ - shdr = calloc(sizeof(*shdr), ehdr->e_shnum); + shdr = calloc(ehdr->e_shnum, sizeof(*shdr)); for (i = 0; i < ehdr->e_shnum; i++) elf_shdr(&b, &shdr[i], ehdr->e_shentsize, xdr, bit64); -- cgit v1.2.3