lkml.org 
[lkml]   [2010]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: [PATCH] KVM: dereference of NULL pointer in set_pal_result()
For the check "(p && p->exit_reason == EXIT_REASON_PAL_CALL", if p is NULL, the reference about "p->exit_reason == EXIT_REASON_PAL_CALL" won't be checked any more, so no issue here. 
Xiantao


Roel Kluin wrote:
> Do not dereference a NULL pointer
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> arch/ia64/kvm/kvm_fw.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c
> index e4b8231..d28494f 100644
> --- a/arch/ia64/kvm/kvm_fw.c
> +++ b/arch/ia64/kvm/kvm_fw.c
> @@ -75,9 +75,11 @@ static void set_pal_result(struct kvm_vcpu *vcpu,
> struct exit_ctl_data *p;
>
> p = kvm_get_exit_data(vcpu);
> - if (p && p->exit_reason == EXIT_REASON_PAL_CALL) {
> + if (!p)
> + return;
> + if (p->exit_reason == EXIT_REASON_PAL_CALL) {
> p->u.pal_data.ret = result;
> - return ;
> + return;
> }
> INIT_PAL_STATUS_UNIMPLEMENTED(p->u.pal_data.ret);
> }



\
 
 \ /
  Last update: 2010-01-08 00:31    [W:0.430 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site