From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>, paul.durrant@citrix.com
Cc: xen-devel@lists.xenproject.org, keir@xen.org
Subject: Re: [PATCH v2 1/3] x86/hvm: give HVMOP_set_param and HVMOP_get_param their own functions
Date: Sat, 02 May 2015 09:09:12 +0100 [thread overview]
Message-ID: <55448628.2000200@citrix.com> (raw)
In-Reply-To: <5543DFBC02000078000CE318@mail.emea.novell.com>
On 01/05/15 20:19, Jan Beulich wrote:
>>>> Paul Durrant <paul.durrant@citrix.com> 05/01/15 4:05 PM >>>
>> --- a/xen/arch/x86/hvm/hvm.c
>> +++ b/xen/arch/x86/hvm/hvm.c
>> @@ -5638,6 +5638,299 @@ static int hvmop_set_evtchn_upcall_vector(
>> return 0;
>> }
> >
>> +static int hvmop_set_param(
>> + XEN_GUEST_HANDLE_PARAM(xen_hvm_param_t) arg)
>> +{
>> + struct domain *curr_d = current->domain;
>> + struct xen_hvm_param a;
>> + struct domain *d;
>> + struct vcpu *v;
>> + int rc = 0;
> Iirc Andrew indicated that Coverity would complain about dead initializers like
> this.
Likely, yes.
It is less clear whether this case would trigger it, but I know for
certain that it dislikes "int rc = 0; rc = fn();"
>
>> + if ( copy_from_guest(&a, arg, 1) )
>> + return -EFAULT;
>> +
>> + if ( a.index >= HVM_NR_PARAMS )
>> + return -EINVAL;
>> +
>> + d = rcu_lock_domain_by_any_id(a.domid);
>> + if ( d == NULL )
>> + return -ESRCH;
>> +
>> + rc = -EINVAL;
> (Not used anywhere up from here.)
>
>> + if ( is_pvh_domain(d)
>> + && (a.index != HVM_PARAM_CALLBACK_IRQ) )
>> + goto out;
> It would have been nice if you had corrected style issues like the misplaced &&
> as you go; I'll try to remember to do so while committing (together with a few more
> and the adjustment for the issue above).
>
>> + case HVM_PARAM_IOREQ_PFN:
>> + case HVM_PARAM_BUFIOREQ_PFN:
>> + case HVM_PARAM_BUFIOREQ_EVTCHN:
>> + {
>> + domid_t domid;
>> +
>> + /* May need to create server */
>> + domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN];
>> + rc = hvm_create_ioreq_server(d, domid, 1, 1, NULL);
>> + if ( rc != 0 && rc != -EEXIST )
>> + goto out;
>> + /*FALLTHRU*/
>> + }
>> + default:
> Andrew - will Coverity be happy with the fall-through comment being followed
> by a closing brace?
I don't have the exact reference to hand (I am still travelling), but I
expect not. Such a brace could be part of an if/else clause which would
mean that it wasn't the only codepath to fall through.
~Andrew
>
> Jan
>
next prev parent reply other threads:[~2015-05-02 8:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 14:05 [PATCH v2 0/3] x86/hvm: HVMOP_get/set_param improvements Paul Durrant
2015-05-01 14:05 ` [PATCH 0/2] " Paul Durrant
2015-05-01 15:10 ` Paul Durrant
2015-05-01 14:05 ` [PATCH v2 1/3] x86/hvm: give HVMOP_set_param and HVMOP_get_param their own functions Paul Durrant
2015-05-01 19:19 ` Jan Beulich
2015-05-02 8:09 ` Andrew Cooper [this message]
2015-05-03 10:25 ` Paul Durrant
2015-05-01 14:05 ` [PATCH v2 2/3] x86/hvm: introduce functions for HVMOP_get/set_param allowance checks Paul Durrant
2015-05-01 19:28 ` Jan Beulich
2015-05-05 9:25 ` Paul Durrant
2015-05-05 9:32 ` Jan Beulich
2015-05-01 14:05 ` [PATCH v2 3/3] x86/hvm: Use white-lists for HVM param guest accessibility checks Paul Durrant
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=55448628.2000200@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=paul.durrant@citrix.com \
--cc=xen-devel@lists.xenproject.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.