All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Paul Durrant <Paul.Durrant@citrix.com>,
	"Keir (Xen.org)" <keir@xen.org>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] Initialize ioreq_t in hvmemul_do_io()
Date: Thu, 22 May 2014 14:47:01 +0100	[thread overview]
Message-ID: <537DFFD5.4060908@citrix.com> (raw)
In-Reply-To: <537E175C0200007800014FD5@mail.emea.novell.com>

On 22/05/14 14:27, Jan Beulich wrote:
>>>> On 22.05.14 at 15:20, <Paul.Durrant@citrix.com> wrote:
>>>  -----Original Message-----
>>> From: Jan Beulich [mailto:JBeulich@suse.com]
>>> Sent: 22 May 2014 14:14
>>> To: Andrew Cooper; Paul Durrant
>>> Cc: xen-devel@lists.xen.org; Keir (Xen.org)
>>> Subject: Re: [PATCH] Initialize ioreq_t in hvmemul_do_io()
>>>
>>>>>> On 22.05.14 at 14:48, <paul.durrant@citrix.com> wrote:
>>>> All relevant fields of the ioreq_t are properly initialized but coverity
>>>> complains about vp_eport being uninitialized (ID 1215178) because it is
>>>> the subject of a struct copy in hvm_send_assist_req().
>>>>
>>>> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
>>>> Cc: Keir Fraser <keir@xen.org>
>>>> Cc: Jan Beulich <jbeulich@suse.com>
>>>> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
>>>> ---
>>>>  xen/arch/x86/hvm/emulate.c |    2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
>>>> index 904c71a..e516194 100644
>>>> --- a/xen/arch/x86/hvm/emulate.c
>>>> +++ b/xen/arch/x86/hvm/emulate.c
>>>> @@ -57,7 +57,7 @@ static int hvmemul_do_io(
>>>>      int value_is_ptr = (p_data == NULL);
>>>>      struct vcpu *curr = current;
>>>>      struct hvm_vcpu_io *vio;
>>>> -    ioreq_t p;
>>>> +    ioreq_t p = { 0 };
>>> To be honest, I dislike fixes like this to address tool shortcomings. It's
>>> not like this is giaramteed to be just a single instruction that gets
>>> added (maybe the compiler can figure this, but I would want to rely
>>> on it.
>>>
>> I could always change hvm_send_assist_req() to only copy the relevant fields 
>> from the proto structure, as it used to in earlier versions of my patch.
> But the structure copy is certainly more efficient than the piece-wise
> copying.
>
> Jan
>

When interpreting the coverity results, I accidentally missed the second
occurrence of this issue.

It is possible to "goto finished_access" and have p.addr and p.dir
uninitialised when tracing the IO.

By far the safest option is just initialise the entire structure to 0.

~Andrew

  reply	other threads:[~2014-05-22 13:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22 12:48 [PATCH] Initialize ioreq_t in hvmemul_do_io() Paul Durrant
2014-05-22 13:14 ` Jan Beulich
2014-05-22 13:20   ` Paul Durrant
2014-05-22 13:27     ` Jan Beulich
2014-05-22 13:47       ` Andrew Cooper [this message]
2014-05-22 14:01         ` Paul Durrant
2014-05-22 14:08         ` Jan Beulich

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=537DFFD5.4060908@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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.