From e1d2cbde2481f77fc9d006c63326b94440b58681 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Jun 2022 09:34:12 +0200 Subject: [PATCH] ElfReader: Suppress a coverity message Add two neutral enum values mimicing what llvm/BinaryFormat/ELF.h has. *** CID 1518686: Uninitialized variables (UNINIT) /qt-creator/src/plugins/debugger/gdb/gdbengine.cpp: 3940 in Debugger::Internal::GdbEngine::handleGdbStarted()() 3934 // Addint executable to modules list. 3935 Module module; 3936 module.startAddress = 0; 3937 module.endAddress = 0; 3938 module.modulePath = rp.inferior.command.executable().toString(); 3939 module.moduleName = ""; >>> CID 1518686: Uninitialized variables (UNINIT) >>> Using uninitialized value "module.elfData.endian" when calling "updateModule". Looks like a false positive, module.elfData.endian is not used in updateModule() and surroundings. Change-Id: Ic8071add87b1df894819d49ea55dfa705b81c3ce Reviewed-by: Eike Ziller Reviewed-by: Qt CI Bot --- src/libs/utils/elfreader.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libs/utils/elfreader.h b/src/libs/utils/elfreader.h index 2f52938b6f1..8e7d808f237 100644 --- a/src/libs/utils/elfreader.h +++ b/src/libs/utils/elfreader.h @@ -83,6 +83,7 @@ enum ElfEndian enum ElfClass { + Elf_ELFCLASSNONE = 0, Elf_ELFCLASS32 = 1, Elf_ELFCLASS64 = 2 }; @@ -98,6 +99,7 @@ enum ElfType enum ElfMachine { + Elf_EM_NONE = 0, Elf_EM_386 = 3, Elf_EM_ARM = 40, Elf_EM_X86_64 = 62 @@ -142,10 +144,10 @@ public: int indexOf(const QByteArray &name) const; public: - ElfEndian endian; - ElfType elftype; - ElfMachine elfmachine; - ElfClass elfclass; + ElfEndian endian = Elf_ELFDATANONE; + ElfType elftype = Elf_ET_NONE; + ElfMachine elfmachine = Elf_EM_NONE; + ElfClass elfclass = Elf_ELFCLASSNONE; quint64 entryPoint = 0; QByteArray debugLink; QByteArray buildId;