Patchwork [11/11] msix: use range helper function.

login
register
mail settings
Submitter Isaku Yamahata
Date Dec. 14, 2009, 12:48 p.m.
Message ID <1260794906-30168-12-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/41099/
State New
Headers show

Comments

Isaku Yamahata - Dec. 14, 2009, 12:48 p.m.
use range helper function in msix_write_config().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/msix.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Michael S. Tsirkin - Dec. 14, 2009, 1:25 p.m.
On Mon, Dec 14, 2009 at 09:48:26PM +0900, Isaku Yamahata wrote:
> use range helper function in msix_write_config().
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/msix.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/msix.c b/hw/msix.c
> index 0baedef..2ca0900 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -175,7 +175,7 @@ void msix_write_config(PCIDevice *dev, uint32_t addr,
>      unsigned enable_pos = dev->msix_cap + MSIX_CONTROL_OFFSET;
>      int vector;
>  
> -    if (addr + len <= enable_pos || addr > enable_pos) {
> +    if (!range_covers_byte(addr, len, enable_pos)) {
>          return;
>      }
>  
> -- 
> 1.6.5.4

Patch

diff --git a/hw/msix.c b/hw/msix.c
index 0baedef..2ca0900 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -175,7 +175,7 @@  void msix_write_config(PCIDevice *dev, uint32_t addr,
     unsigned enable_pos = dev->msix_cap + MSIX_CONTROL_OFFSET;
     int vector;
 
-    if (addr + len <= enable_pos || addr > enable_pos) {
+    if (!range_covers_byte(addr, len, enable_pos)) {
         return;
     }