Subject: [PATCH] kvm: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] kvm: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()

This takes care of the following entries from Dan's list:

arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable derefenced in initializer 'vcpu'
arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable derefenced before check 'vcpu'

Reported-by: Dan Carpenter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Julia Lawall <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
---
arch/x86/kvm/i8254.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/arch/x86/kvm/i8254.c
===================================================================
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -713,7 +713,7 @@ void kvm_inject_pit_timer_irqs(struct kv
struct kvm *kvm = vcpu->kvm;
struct kvm_kpit_state *ps;

- if (vcpu && pit) {
+ if (pit) {
int inject = 0;
ps = &pit->pit_state;


2009-07-29 03:03:37

by Sheng Yang

[permalink] [raw]
Subject: Re: [PATCH] kvm: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()

On Wednesday 29 July 2009 06:46:38 Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz <[email protected]>
> Subject: [PATCH] kvm: remove superfluous NULL pointer check in
> kvm_inject_pit_timer_irqs()
>
> This takes care of the following entries from Dan's list:
>
> arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable
> derefenced in initializer 'vcpu' arch/x86/kvm/i8254.c +714
> kvm_inject_pit_timer_irqs(6) warning: variable derefenced before check
> 'vcpu'
>
> Reported-by: Dan Carpenter <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: Julia Lawall <[email protected]>
> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
> ---
> arch/x86/kvm/i8254.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: b/arch/x86/kvm/i8254.c
> ===================================================================
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -713,7 +713,7 @@ void kvm_inject_pit_timer_irqs(struct kv
> struct kvm *kvm = vcpu->kvm;
> struct kvm_kpit_state *ps;
>
> - if (vcpu && pit) {
> + if (pit) {
> int inject = 0;
> ps = &pit->pit_state;
>
Oh, follow up for the recent zero day exploit, right? :)

Yes, vcpu NULL check is not necessary here.

Acked-by: Sheng Yang <[email protected]>

--
regards
Yang, Sheng

> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2009-07-29 09:58:36

by Avi Kivity

[permalink] [raw]
Subject: Re: [PATCH] kvm: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()

On 07/29/2009 01:46 AM, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz<[email protected]>
> Subject: [PATCH] kvm: remove superfluous NULL pointer check in kvm_inject_pit_timer_irqs()
>
> This takes care of the following entries from Dan's list:
>
> arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable derefenced in initializer 'vcpu'
> arch/x86/kvm/i8254.c +714 kvm_inject_pit_timer_irqs(6) warning: variable derefenced before check 'vcpu'
>
>

Applied, thanks.

--
error compiling committee.c: too many arguments to function