From 12036af3466700f6ea6e64066a19135a3f6d9817 Mon Sep 17 00:00:00 2001 From: l00580197 Date: Thu, 6 Jul 2023 10:26:53 +0800 Subject: [PATCH] fix codecheck Signed-off-by: l00580197 --- src/elf_check_elf.c | 9 ++++++--- src/elf_hugepage.c | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/elf_check_elf.c b/src/elf_check_elf.c index 6b77dd6..241e9d4 100644 --- a/src/elf_check_elf.c +++ b/src/elf_check_elf.c @@ -3,10 +3,11 @@ #include #include -#include "elf_link_common.h" #include #include +#include "elf_link_common.h" + static void check_bss_addr(elf_file_t *out_ef) { // in kernel, bss addr = data segment + filesize @@ -40,8 +41,9 @@ static bool is_dynsym_valid(Elf64_Sym *sym, const char *name) return true; } - if (sym->st_shndx == SHN_UNDEF) + if (sym->st_shndx == SHN_UNDEF) { return false; + } return true; } @@ -80,8 +82,9 @@ static void check_dynamic(elf_link_t *elf_link) elf_file_t *out_ef = &elf_link->out_ef; Elf64_Shdr *sec = elf_find_section_by_name(out_ef, ".dynamic"); - if (is_share_mode(elf_link) == false) + if (is_share_mode(elf_link) == false) { return; + } // dyn mode must be DT_BIND_NOW dyn_count = sec->sh_size / sec->sh_entsize; diff --git a/src/elf_hugepage.c b/src/elf_hugepage.c index 0fa87ed..7310d6f 100644 --- a/src/elf_hugepage.c +++ b/src/elf_hugepage.c @@ -54,11 +54,13 @@ void elf_set_hugepage(elf_link_t *elf_link) Elf64_Phdr *phdr = (Elf64_Phdr *)ef->hdr_Phdr; for (i = 0; i < count; i++) { - if (phdr[i].p_type == PT_LOAD) { - if (exec_only && !(phdr[i].p_flags & PF_X)) - continue; - phdr[i].p_flags |= PF_HUGEPAGE; + if (phdr[i].p_type != PT_LOAD) { + continue; } + if (exec_only && !(phdr[i].p_flags & PF_X)) { + continue; + } + phdr[i].p_flags |= PF_HUGEPAGE; } _elf_set_aot(ef, true); -- Gitee