summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-03-05 14:54:13 -0600
committerAaron Durbin <adurbin@google.com>2014-03-13 05:28:57 +0100
commitb1b5118c717d673506292dced272a0837612fc17 (patch)
tree5fe195d2dc3bb599e7e40397c752331fa74c7633 /util
parent54ef306377024bea83ffe0622c9a53ab4f4f5ec1 (diff)
downloadcoreboot-b1b5118c717d673506292dced272a0837612fc17.tar.xz
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 <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5371 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/elfheaders.c4
1 files changed, 2 insertions, 2 deletions
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);