From deb77192809fb919b61c19b347a233ebc79df1b4 Mon Sep 17 00:00:00 2001 From: Artem Savkov Date: Wed, 31 Jul 2019 13:51:55 +0200 Subject: [PATCH] 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 --- kpatch-build/create-diff-object.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 35a609a..f7a172d 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -2186,6 +2186,9 @@ static void kpatch_regenerate_orc_sections(struct kpatch_elf *kelf) return; orc_entry_size = atoi(str); + if (!orc_entry_size) + ERROR("bad ORC_STRUCT_SIZE"); + LIST_HEAD(newrelas); orc_sec = find_section_by_name(&kelf->sections, ".orc_unwind");