public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Han, Weidong" <weidong.han@intel.com>
Cc: "'kvm@vger.kernel.org'" <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/2] kvm: qemu: check device assignment command
Date: Thu, 26 Mar 2009 14:04:37 +0200	[thread overview]
Message-ID: <49CB6F55.10603@redhat.com> (raw)
In-Reply-To: <715D42877B251141A38726ABF5CABF2C01A11B66EE@pdsmsx503.ccr.corp.intel.com>

Han, Weidong wrote:
> Device assignment command is like "-pcidevice host=xx:yy.z".
> Check bus:dev.func length to make sure its format is xx:yy.z.
>
> Signed-off-by: Weidong Han <weidong.han@intel.com>
> ---
>  qemu/hw/device-assignment.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c
> index cef7c8a..50a0d5c 100644
> --- a/qemu/hw/device-assignment.c
> +++ b/qemu/hw/device-assignment.c
> @@ -1196,7 +1196,7 @@ out:
>  AssignedDevInfo *add_assigned_device(const char *arg)
>  {
>      char *cp, *cp1;
> -    char device[8];
> +    char device[9];
>      char dma[6];
>      int r;
>      AssignedDevInfo *adev;
> @@ -1207,6 +1207,9 @@ AssignedDevInfo *add_assigned_device(const char *arg)
>          return NULL;
>      }
>      r = get_param_value(device, sizeof(device), "host", arg);
> +    /* b:d.f format: xx:yy.z */
> +    if (r != 7)
> +        goto bad;
>      r = get_param_value(adev->name, sizeof(adev->name), "name", arg);
>      if (!r)
>  	snprintf(adev->name, sizeof(adev->name), "%s", device);
>   

I suggest replacing the parsing code with pci_parse_devaddr() (needs to 
be extended to support functions) so that all the checking and parsing 
is done in one place.

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


  reply	other threads:[~2009-03-26 12:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26  9:02 [PATCH 2/2] kvm: qemu: check device assignment command Han, Weidong
2009-03-26 12:04 ` Avi Kivity [this message]
2009-03-27  9:31   ` Han, Weidong
2009-03-29 14:35     ` Avi Kivity
2009-03-30 12:41       ` Han, Weidong
2009-04-01  9:18         ` Avi Kivity

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=49CB6F55.10603@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=weidong.han@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox