From: Avi Kivity <avi@redhat.com>
To: kvm-ia64@vger.kernel.org
Subject: Re: + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch
Date: Wed, 13 Jan 2010 09:37:57 +0000 [thread overview]
Message-ID: <4B4D9475.6050906@redhat.com> (raw)
In-Reply-To: <4B4D90DF.7020700@redhat.com>
On 01/13/2010 11:32 AM, Andrew Morton wrote:
> On Wed, 13 Jan 2010 11:22:39 +0200 Avi Kivity<avi@redhat.com> wrote:
>
>
>> On 01/13/2010 12:11 AM, akpm@linux-foundation.org wrote:
>>
>>> Subject: kvm/ia64: dereference of NULL pointer in set_pal_result()
>>> From: Roel Kluin<roel.kluin@gmail.com>
>>>
>>> Do not dereference a NULL pointer
>>>
>>> diff -puN arch/ia64/kvm/kvm_fw.c~kvm-ia64-dereference-of-null-pointer-in-set_pal_result arch/ia64/kvm/kvm_fw.c
>>> --- a/arch/ia64/kvm/kvm_fw.c~kvm-ia64-dereference-of-null-pointer-in-set_pal_result
>>> +++ a/arch/ia64/kvm/kvm_fw.c
>>> @@ -75,9 +75,11 @@ static void set_pal_result(struct kvm_vc
>>> 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);
>>> }
>>>
>>>
>>
>> kvm_get_exit_data() cannot return a NULL pointer.
>>
> In that case set_pal_result() doesn't need to test for that.
>
> Roel looks for code along the lines of
>
> if (p)
> ...
>
> *p;
>
I see. I think it's worthwhile to look deeper rather than converting
things mechanically. After all, the code may have actually worked
before the patch.
--
error compiling committee.c: too many arguments to function
WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KVM list <kvm@vger.kernel.org>,
roel.kluin@gmail.com, mtosatti@redhat.com, tony.luck@intel.com,
xiantao.zhang@intel.com,
"kvm-ia64@vger.kernel.org" <kvm-ia64@vger.kernel.org>
Subject: Re: + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch added to -mm tree
Date: Wed, 13 Jan 2010 11:37:57 +0200 [thread overview]
Message-ID: <4B4D9475.6050906@redhat.com> (raw)
In-Reply-To: <20100113013253.5913fc63.akpm@linux-foundation.org>
On 01/13/2010 11:32 AM, Andrew Morton wrote:
> On Wed, 13 Jan 2010 11:22:39 +0200 Avi Kivity<avi@redhat.com> wrote:
>
>
>> On 01/13/2010 12:11 AM, akpm@linux-foundation.org wrote:
>>
>>> Subject: kvm/ia64: dereference of NULL pointer in set_pal_result()
>>> From: Roel Kluin<roel.kluin@gmail.com>
>>>
>>> Do not dereference a NULL pointer
>>>
>>> diff -puN arch/ia64/kvm/kvm_fw.c~kvm-ia64-dereference-of-null-pointer-in-set_pal_result arch/ia64/kvm/kvm_fw.c
>>> --- a/arch/ia64/kvm/kvm_fw.c~kvm-ia64-dereference-of-null-pointer-in-set_pal_result
>>> +++ a/arch/ia64/kvm/kvm_fw.c
>>> @@ -75,9 +75,11 @@ static void set_pal_result(struct kvm_vc
>>> 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);
>>> }
>>>
>>>
>>
>> kvm_get_exit_data() cannot return a NULL pointer.
>>
> In that case set_pal_result() doesn't need to test for that.
>
> Roel looks for code along the lines of
>
> if (p)
> ...
>
> *p;
>
I see. I think it's worthwhile to look deeper rather than converting
things mechanically. After all, the code may have actually worked
before the patch.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-01-13 9:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 9:22 + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch Avi Kivity
2010-01-13 9:22 ` + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch added to -mm tree Avi Kivity
2010-01-13 9:32 ` + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch Andrew Morton
2010-01-13 9:32 ` + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch added to -mm tree Andrew Morton
2010-01-13 9:37 ` Avi Kivity [this message]
2010-01-13 9:37 ` Avi Kivity
2010-01-13 9:59 ` + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch Zhang, Xiantao
2010-01-13 9:59 ` + kvm-ia64-dereference-of-null-pointer-in-set_pal_result.patch added to -mm tree Zhang, Xiantao
-- strict thread matches above, loose matches on Subject: below --
2010-01-12 22:11 akpm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4D9475.6050906@redhat.com \
--to=avi@redhat.com \
--cc=kvm-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.