[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] vt-d: Fix PCI=device parsing.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1193059605 -3600
# Node ID 24c2745f939ff1bb221b0a753c2a0cbc8b21da97
# Parent  368f563f2fd0909ba28a41a7c80d5ebdb9b9bda5
vt-d: Fix PCI=device parsing.
Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx>
---
 tools/ioemu/hw/pass-through.c     |   12 ++++++------
 tools/python/xen/lowlevel/xc/xc.c |   12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff -r 368f563f2fd0 -r 24c2745f939f tools/ioemu/hw/pass-through.c
--- a/tools/ioemu/hw/pass-through.c     Mon Oct 22 14:22:39 2007 +0100
+++ b/tools/ioemu/hw/pass-through.c     Mon Oct 22 14:26:45 2007 +0100
@@ -39,11 +39,10 @@ static int next_bdf(char **str, int *seg
 {
     char *token;
 
-    token = strchr(*str, ',');
-    if ( !token )
+    if ( !(*str) || !strchr(*str, ',') )
         return 0;
-    token++;
-
+
+    token = *str;
     *seg  = token_value(token);
     token = strchr(token, ',') + 1;
     *bus  = token_value(token);
@@ -51,8 +50,9 @@ static int next_bdf(char **str, int *seg
     *dev  = token_value(token);
     token = strchr(token, ',') + 1;
     *func  = token_value(token);
-
-    *str = token;
+    token = strchr(token, ',');
+    *str = token ? token + 1 : NULL;
+
     return 1;
 }
 
diff -r 368f563f2fd0 -r 24c2745f939f tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Mon Oct 22 14:22:39 2007 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Mon Oct 22 14:26:45 2007 +0100
@@ -543,11 +543,10 @@ static int next_bdf(char **str, int *seg
 {
     char *token;
 
-    token = strchr(*str, ',');
-    if ( !token )
+    if ( !(*str) || !strchr(*str, ',') )
         return 0;
-    token++;
-
+
+    token = *str;
     *seg  = token_value(token);
     token = strchr(token, ',') + 1;
     *bus  = token_value(token);
@@ -555,8 +554,9 @@ static int next_bdf(char **str, int *seg
     *dev  = token_value(token);
     token = strchr(token, ',') + 1;
     *func  = token_value(token);
-
-    *str = token;
+    token = strchr(token, ',');
+    *str = token ? token + 1 : NULL;
+
     return 1;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.