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>
This commit is contained in:
parent
54ef306377
commit
b1b5118c71
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue