* [PATCH 0/3] KVM: Fix sparse warnings.
@ 2015-03-13 9:39 Xiubo Li
2015-03-13 9:39 ` [PATCH 1/3] KVM: X86: Avoid using plain integer as NULL pointer warning Xiubo Li
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Xiubo Li @ 2015-03-13 9:39 UTC (permalink / raw)
To: mtosatti; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm, Xiubo Li
Using the command like: 'make C=1 xxxx', the sparse tool will complain
about warnings like:
warning: symbol 'XXX' was not declared. Should it be static?
warning: Using plain integer as NULL pointer
...
And also, if the symbols will only used locally, shouldn't it be static?
Xiubo Li (3):
KVM: X86: Avoid using plain integer as NULL pointer warning.
KVM: X86: For the symbols used locally only should be static type.
KVM: For the symbols used locally only should be static type.
arch/x86/kvm/pmu.c | 2 +-
arch/x86/kvm/svm.c | 3 ++-
arch/x86/kvm/x86.c | 13 ++++++++-----
virt/kvm/kvm_main.c | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] KVM: X86: Avoid using plain integer as NULL pointer warning.
2015-03-13 9:39 [PATCH 0/3] KVM: Fix sparse warnings Xiubo Li
@ 2015-03-13 9:39 ` Xiubo Li
2015-03-13 9:39 ` [PATCH 2/3] KVM: X86: For the symbols used locally only should be static type Xiubo Li
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Xiubo Li @ 2015-03-13 9:39 UTC (permalink / raw)
To: mtosatti; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm, Xiubo Li
This patch fix the following sparse warning:
for file arch/x86/kvm/x86.c:
warning: Using plain integer as NULL pointer
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
---
arch/x86/kvm/x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bd7a70b..1e2e9b4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5904,7 +5904,7 @@ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid)
lapic_irq.dest_id = apicid;
lapic_irq.delivery_mode = APIC_DM_REMRD;
- kvm_irq_delivery_to_apic(kvm, 0, &lapic_irq, NULL);
+ kvm_irq_delivery_to_apic(kvm, NULL, &lapic_irq, NULL);
}
int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] KVM: X86: For the symbols used locally only should be static type.
2015-03-13 9:39 [PATCH 0/3] KVM: Fix sparse warnings Xiubo Li
2015-03-13 9:39 ` [PATCH 1/3] KVM: X86: Avoid using plain integer as NULL pointer warning Xiubo Li
@ 2015-03-13 9:39 ` Xiubo Li
2015-03-13 9:39 ` [PATCH 3/3] KVM: " Xiubo Li
2015-03-18 1:39 ` [PATCH 0/3] KVM: Fix sparse warnings Marcelo Tosatti
3 siblings, 0 replies; 7+ messages in thread
From: Xiubo Li @ 2015-03-13 9:39 UTC (permalink / raw)
To: mtosatti; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm, Xiubo Li
This patch fix the following sparse warnings:
for arch/x86/kvm/x86.c:
warning: symbol 'emulator_read_write' was not declared. Should it be static?
warning: symbol 'emulator_write_emulated' was not declared. Should it be static?
warning: symbol 'emulator_get_dr' was not declared. Should it be static?
warning: symbol 'emulator_set_dr' was not declared. Should it be static?
for arch/x86/kvm/pmu.c:
warning: symbol 'fixed_pmc_events' was not declared. Should it be static?
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
---
arch/x86/kvm/pmu.c | 2 +-
arch/x86/kvm/svm.c | 3 ++-
arch/x86/kvm/x86.c | 11 +++++++----
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 8e6b7d8..29fbf9d 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -38,7 +38,7 @@ static struct kvm_arch_event_perf_mapping {
};
/* mapping between fixed pmc index and arch_events array */
-int fixed_pmc_events[] = {1, 0, 7};
+static int fixed_pmc_events[] = {1, 0, 7};
static bool pmc_is_gp(struct kvm_pmc *pmc)
{
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index d319e0c..fa675d3 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2902,7 +2902,8 @@ static int rdpmc_interception(struct vcpu_svm *svm)
return 1;
}
-bool check_selective_cr0_intercepted(struct vcpu_svm *svm, unsigned long val)
+static bool check_selective_cr0_intercepted(struct vcpu_svm *svm,
+ unsigned long val)
{
unsigned long cr0 = svm->vcpu.arch.cr0;
bool ret = false;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1e2e9b4..3af4651 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4476,7 +4476,8 @@ mmio:
return X86EMUL_CONTINUE;
}
-int emulator_read_write(struct x86_emulate_ctxt *ctxt, unsigned long addr,
+static int emulator_read_write(struct x86_emulate_ctxt *ctxt,
+ unsigned long addr,
void *val, unsigned int bytes,
struct x86_exception *exception,
const struct read_write_emulator_ops *ops)
@@ -4539,7 +4540,7 @@ static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt,
exception, &read_emultor);
}
-int emulator_write_emulated(struct x86_emulate_ctxt *ctxt,
+static int emulator_write_emulated(struct x86_emulate_ctxt *ctxt,
unsigned long addr,
const void *val,
unsigned int bytes,
@@ -4730,12 +4731,14 @@ static void emulator_wbinvd(struct x86_emulate_ctxt *ctxt)
kvm_emulate_wbinvd(emul_to_vcpu(ctxt));
}
-int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long *dest)
+static int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr,
+ unsigned long *dest)
{
return kvm_get_dr(emul_to_vcpu(ctxt), dr, dest);
}
-int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value)
+static int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr,
+ unsigned long value)
{
return __kvm_set_dr(emul_to_vcpu(ctxt), dr, value);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] KVM: For the symbols used locally only should be static type.
2015-03-13 9:39 [PATCH 0/3] KVM: Fix sparse warnings Xiubo Li
2015-03-13 9:39 ` [PATCH 1/3] KVM: X86: Avoid using plain integer as NULL pointer warning Xiubo Li
2015-03-13 9:39 ` [PATCH 2/3] KVM: X86: For the symbols used locally only should be static type Xiubo Li
@ 2015-03-13 9:39 ` Xiubo Li
2015-03-13 13:37 ` Christian Borntraeger
2015-03-18 1:39 ` [PATCH 0/3] KVM: Fix sparse warnings Marcelo Tosatti
3 siblings, 1 reply; 7+ messages in thread
From: Xiubo Li @ 2015-03-13 9:39 UTC (permalink / raw)
To: mtosatti; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm, Xiubo Li
This patch fix the following sparse warnings:
for file virt/kvm/kvm_main.c:
warning: symbol 'halt_poll_ns' was not declared. Should it be static?
Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
---
virt/kvm/kvm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a109370..a23d2ba 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -66,7 +66,7 @@
MODULE_AUTHOR("Qumranet");
MODULE_LICENSE("GPL");
-unsigned int halt_poll_ns = 0;
+static unsigned int halt_poll_ns;
module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR);
/*
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] KVM: For the symbols used locally only should be static type.
2015-03-13 9:39 ` [PATCH 3/3] KVM: " Xiubo Li
@ 2015-03-13 13:37 ` Christian Borntraeger
2015-03-16 0:45 ` [PATCH 3/3] KVM: For the symbols used locally only should bestatic type Xiubo Li
0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2015-03-13 13:37 UTC (permalink / raw)
To: Xiubo Li, mtosatti; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm
Am 13.03.2015 um 10:39 schrieb Xiubo Li:
> This patch fix the following sparse warnings:
>
> for file virt/kvm/kvm_main.c:
> warning: symbol 'halt_poll_ns' was not declared. Should it be static?
>
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
> virt/kvm/kvm_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index a109370..a23d2ba 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -66,7 +66,7 @@
> MODULE_AUTHOR("Qumranet");
> MODULE_LICENSE("GPL");
>
> -unsigned int halt_poll_ns = 0;
> +static unsigned int halt_poll_ns;
> module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR);
>
> /*
>
This change is already part of kvm/queue
https://git.kernel.org/cgit/virt/kvm/kvm.git/commit/?h=queue&id=0fa9778895635ab3824caf34fd573562dd2b999c
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] KVM: For the symbols used locally only should bestatic type.
2015-03-13 13:37 ` Christian Borntraeger
@ 2015-03-16 0:45 ` Xiubo Li
0 siblings, 0 replies; 7+ messages in thread
From: Xiubo Li @ 2015-03-16 0:45 UTC (permalink / raw)
To: Christian Borntraeger, mtosatti; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm
On 13/03/2015 21:37, Christian Borntraeger wrote:
> Am 13.03.2015 um 10:39 schrieb Xiubo Li:
>> This patch fix the following sparse warnings:
>>
>> for file virt/kvm/kvm_main.c:
>> warning: symbol 'halt_poll_ns' was not declared. Should it be static?
>>
>> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
>> ---
>> virt/kvm/kvm_main.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index a109370..a23d2ba 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -66,7 +66,7 @@
>> MODULE_AUTHOR("Qumranet");
>> MODULE_LICENSE("GPL");
>>
>> -unsigned int halt_poll_ns = 0;
>> +static unsigned int halt_poll_ns;
>> module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR);
>>
>> /*
>>
> This change is already part of kvm/queue
>
> https://git.kernel.org/cgit/virt/kvm/kvm.git/commit/?h=queue&id=0fa9778895635ab3824caf34fd573562dd2b999c
>
Yes, right, before this patch, i had already synced the newest version,
but didn't find this patch.
I will abandon it.
Thanks,
BRs
Xiubo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] KVM: Fix sparse warnings.
2015-03-13 9:39 [PATCH 0/3] KVM: Fix sparse warnings Xiubo Li
` (2 preceding siblings ...)
2015-03-13 9:39 ` [PATCH 3/3] KVM: " Xiubo Li
@ 2015-03-18 1:39 ` Marcelo Tosatti
3 siblings, 0 replies; 7+ messages in thread
From: Marcelo Tosatti @ 2015-03-18 1:39 UTC (permalink / raw)
To: Xiubo Li; +Cc: gleb, pbonzini, tglx, mingo, hpa, kvm
On Fri, Mar 13, 2015 at 05:39:43PM +0800, Xiubo Li wrote:
> Using the command like: 'make C=1 xxxx', the sparse tool will complain
> about warnings like:
>
> warning: symbol 'XXX' was not declared. Should it be static?
> warning: Using plain integer as NULL pointer
> ...
>
> And also, if the symbols will only used locally, shouldn't it be static?
>
>
> Xiubo Li (3):
> KVM: X86: Avoid using plain integer as NULL pointer warning.
> KVM: X86: For the symbols used locally only should be static type.
> KVM: For the symbols used locally only should be static type.
Applied 1 and 2, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-18 1:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13 9:39 [PATCH 0/3] KVM: Fix sparse warnings Xiubo Li
2015-03-13 9:39 ` [PATCH 1/3] KVM: X86: Avoid using plain integer as NULL pointer warning Xiubo Li
2015-03-13 9:39 ` [PATCH 2/3] KVM: X86: For the symbols used locally only should be static type Xiubo Li
2015-03-13 9:39 ` [PATCH 3/3] KVM: " Xiubo Li
2015-03-13 13:37 ` Christian Borntraeger
2015-03-16 0:45 ` [PATCH 3/3] KVM: For the symbols used locally only should bestatic type Xiubo Li
2015-03-18 1:39 ` [PATCH 0/3] KVM: Fix sparse warnings Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).