diff mbox

target-i386: Add missing 'static' and 'const' attributes

Message ID 1394978621-19738-1-git-send-email-sw@weilnetz.de (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Weil March 16, 2014, 2:03 p.m. UTC
This fixes warnings from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

Why is array para_features in kvm.c terminated by a dummy entry?
It is only used in a for loop with upper limit ARRAY_SIZE(para_features) - 1.

Regards
Stefan

 target-i386/cpu.c |    2 +-
 target-i386/kvm.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini March 17, 2014, 9:56 a.m. UTC | #1
Il 16/03/2014 15:03, Stefan Weil ha scritto:
> This fixes warnings from the static code analysis (smatch).
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> Why is array para_features in kvm.c terminated by a dummy entry?
> It is only used in a for loop with upper limit ARRAY_SIZE(para_features) - 1.

No particular reason.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index e7e62c5..8fd1497 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -316,7 +316,7 @@  typedef struct X86RegisterInfo32 {
 
 #define REGISTER(reg) \
     [R_##reg] = { .name = #reg, .qapi_enum = X86_CPU_REGISTER32_##reg }
-X86RegisterInfo32 x86_reg_info_32[CPU_NB_REGS32] = {
+static const X86RegisterInfo32 x86_reg_info_32[CPU_NB_REGS32] = {
     REGISTER(EAX),
     REGISTER(ECX),
     REGISTER(EDX),
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 7a295f6..4389959 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -122,7 +122,7 @@  static struct kvm_cpuid2 *get_supported_cpuid(KVMState *s)
     return cpuid;
 }
 
-struct kvm_para_features {
+static const struct kvm_para_features {
     int cap;
     int feature;
 } para_features[] = {