mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/livepatch: Use zeroed memory allocations for arrays
Each of these arrays is sparse. Use zeroed allocations to cause uninitialised
array elements to contain deterministic values, most importantly for the
embedded pointers.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> [x86 and arm32]
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
master commit: bd53b85156
master date: 2017-06-23 15:00:37 +0100
This commit is contained in:
1 parent
3d63ebca46
commit
ece330ae94
2 files changed
+4
-4
No files matched your search
@@ -707,8 +707,8 @@ static int build_symbol_table(struct payload *payload,
|
||||
}
|
||||
}
|
||||
|
||||
symtab = xmalloc_array(struct livepatch_symbol, nsyms);
|
||||
strtab = xmalloc_array(char, strtab_len);
|
||||
symtab = xzalloc_array(struct livepatch_symbol, nsyms);
|
||||
strtab = xzalloc_array(char, strtab_len);
|
||||
|
||||
if ( !strtab || !symtab )
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
|
||||
int rc;
|
||||
|
||||
/* livepatch_elf_load sanity checked e_shnum. */
|
||||
sec = xmalloc_array(struct livepatch_elf_sec, elf->hdr->e_shnum);
|
||||
sec = xzalloc_array(struct livepatch_elf_sec, elf->hdr->e_shnum);
|
||||
if ( !sec )
|
||||
{
|
||||
dprintk(XENLOG_ERR, LIVEPATCH"%s: Could not allocate memory for section table!\n",
|
||||
@@ -221,7 +221,7 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
|
||||
/* No need to check values as elf_resolve_sections did it. */
|
||||
nsym = symtab_sec->sec->sh_size / symtab_sec->sec->sh_entsize;
|
||||
|
||||
sym = xmalloc_array(struct livepatch_elf_sym, nsym);
|
||||
sym = xzalloc_array(struct livepatch_elf_sym, nsym);
|
||||
if ( !sym )
|
||||
{
|
||||
dprintk(XENLOG_ERR, LIVEPATCH "%s: Could not allocate memory for symbols\n",
|
||||
|
||||