mirror of
https://github.com/dynup/kpatch
synced 2025-04-28 22:17:58 +00:00
create-diff-object: check mallor retval in kpatch_create_mcount_sections()
newdata variable is allocated through malloc call and requires a NULL check. Found by covscan, see issue #984 for full log. Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
parent
deb7719280
commit
dba95bae62
@ -3156,6 +3156,9 @@ static void kpatch_create_mcount_sections(struct kpatch_elf *kelf)
|
||||
* __fentry__" so that ftrace will be happy.
|
||||
*/
|
||||
newdata = malloc(sym->sec->data->d_size);
|
||||
if (!newdata)
|
||||
ERROR("malloc");
|
||||
|
||||
memcpy(newdata, sym->sec->data->d_buf, sym->sec->data->d_size);
|
||||
sym->sec->data->d_buf = newdata;
|
||||
insn = newdata;
|
||||
|
Loading…
Reference in New Issue
Block a user