All of lore.kernel.org
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: Ken CC <ken.ccao@gmail.com>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org,
	"Michael S\. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] Check pci slot number in parse_pci_devfn
Date: Tue, 24 Aug 2010 20:35:21 +0900	[thread overview]
Message-ID: <20100824113521.GA7201@valinux.co.jp> (raw)
In-Reply-To: <20100824064927.GB11495@kt>

Add Cc: mst@redhat.com.

MAX_PCI_SLOTS should be in pci.h instead of qdev.h?
And the name should be start with PCI_ prefix for consistency?

Except that, the patches look okay.

thanks,

On Tue, Aug 24, 2010 at 02:49:27PM +0800, Ken CC wrote:
> Define MAX_PCI_SLOTS as 0x1f, if pci addr provided from command line
> is bigger than 0x1f, return error -EINVAL.
> 
> 0x1f << 3 | 7 == 255 (PCIBUS_MAX_DEVICES - 1)
> 
> Signed-off-by: Ken CC <ken.ccao@gmail.com>
> ---
>  hw/qdev-properties.c |    2 ++
>  hw/qdev.h            |    3 +++
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 9219cd7..96d814c 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -514,6 +514,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
>              return -EINVAL;
>          }
>      }
> +    if (slot > MAX_PCI_SLOTS)
> +        return -EINVAL;
>      if (str[n] != '\0')
>          return -EINVAL;
>      if (fn > 7)
> diff --git a/hw/qdev.h b/hw/qdev.h
> index 678f8b7..fcfe52e 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -7,6 +7,9 @@
>  #include "qemu-char.h"
>  #include "qemu-option.h"
>  
> +
> +#define MAX_PCI_SLOTS 0x1f
> +
>  typedef struct Property Property;
>  
>  typedef struct PropertyInfo PropertyInfo;
> 
> 

-- 
yamahata

WARNING: multiple messages have this Message-ID (diff)
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: Ken CC <ken.ccao@gmail.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] Check pci slot number in parse_pci_devfn
Date: Tue, 24 Aug 2010 20:35:21 +0900	[thread overview]
Message-ID: <20100824113521.GA7201@valinux.co.jp> (raw)
In-Reply-To: <20100824064927.GB11495@kt>

Add Cc: mst@redhat.com.

MAX_PCI_SLOTS should be in pci.h instead of qdev.h?
And the name should be start with PCI_ prefix for consistency?

Except that, the patches look okay.

thanks,

On Tue, Aug 24, 2010 at 02:49:27PM +0800, Ken CC wrote:
> Define MAX_PCI_SLOTS as 0x1f, if pci addr provided from command line
> is bigger than 0x1f, return error -EINVAL.
> 
> 0x1f << 3 | 7 == 255 (PCIBUS_MAX_DEVICES - 1)
> 
> Signed-off-by: Ken CC <ken.ccao@gmail.com>
> ---
>  hw/qdev-properties.c |    2 ++
>  hw/qdev.h            |    3 +++
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 9219cd7..96d814c 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -514,6 +514,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
>              return -EINVAL;
>          }
>      }
> +    if (slot > MAX_PCI_SLOTS)
> +        return -EINVAL;
>      if (str[n] != '\0')
>          return -EINVAL;
>      if (fn > 7)
> diff --git a/hw/qdev.h b/hw/qdev.h
> index 678f8b7..fcfe52e 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -7,6 +7,9 @@
>  #include "qemu-char.h"
>  #include "qemu-option.h"
>  
> +
> +#define MAX_PCI_SLOTS 0x1f
> +
>  typedef struct Property Property;
>  
>  typedef struct PropertyInfo PropertyInfo;
> 
> 

-- 
yamahata

  reply	other threads:[~2010-08-24 11:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24  6:33 [PATCH 1/3] PCI: define max devices number on PCIBus as PCIBUS_MAX_DEVICES in pci.h Ken CC
2010-08-24  6:33 ` [Qemu-devel] " Ken CC
2010-08-24  6:48 ` [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus Ken CC
2010-08-24  6:48   ` [Qemu-devel] " Ken CC
2010-08-24  6:49 ` [PATCH 3/3] Check pci slot number in parse_pci_devfn Ken CC
2010-08-24  6:49   ` [Qemu-devel] " Ken CC
2010-08-24 11:35   ` Isaku Yamahata [this message]
2010-08-24 11:35     ` Isaku Yamahata
2010-08-24 11:42     ` Avi Kivity
2010-08-24 11:42       ` Avi Kivity
2010-08-24 12:07       ` Isaku Yamahata
2010-08-24 12:07         ` Isaku Yamahata
2010-08-24 12:04         ` Avi Kivity
2010-08-24 12:04           ` Avi Kivity
2010-08-24 12:16           ` Chen Cao
2010-08-24 12:16             ` Chen Cao
2010-08-24 12:19             ` Avi Kivity
2010-08-24 12:19               ` Avi Kivity
2010-08-24 12:24           ` Isaku Yamahata
2010-08-24 12:24             ` Isaku Yamahata
2010-08-24 12:16             ` Avi Kivity
2010-08-24 12:16               ` Avi Kivity
     [not found] <20100824062517.12408.45246.stgit@k1>
2010-08-24  6:34 ` Ken CC

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=20100824113521.GA7201@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --cc=ken.ccao@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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.