create-diff-object: check ORC_STRUCT_SIZE correctness in kpatch_regenerate_orc_sections()

Since ORC_STRUCT_SIZE is used for division in
kpatch_regenerate_orc_sections() we need to make sure that it is
properly set.

Found by covscan, see issue #984 for full log.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2019-07-31 13:51:55 +02:00
parent f0d071def7
commit deb7719280
1 changed files with 3 additions and 0 deletions

View File

@ -2186,6 +2186,9 @@ static void kpatch_regenerate_orc_sections(struct kpatch_elf *kelf)
return; return;
orc_entry_size = atoi(str); orc_entry_size = atoi(str);
if (!orc_entry_size)
ERROR("bad ORC_STRUCT_SIZE");
LIST_HEAD(newrelas); LIST_HEAD(newrelas);
orc_sec = find_section_by_name(&kelf->sections, ".orc_unwind"); orc_sec = find_section_by_name(&kelf->sections, ".orc_unwind");