aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xensource.com>2007-10-22 14:26:45 +0100
committerKeir Fraser <keir@xensource.com>2007-10-22 14:26:45 +0100
commitde91f88afe9c50141f681469fbed357571f1c3eb (patch)
tree8a41ccfa168e0813156015ac21619e10dbc5229a
parentbdeaa9684d515dfad1ec969957b8e198cd4d162e (diff)
downloadxen-de91f88afe9c50141f681469fbed357571f1c3eb.tar.gz
xen-de91f88afe9c50141f681469fbed357571f1c3eb.tar.bz2
xen-de91f88afe9c50141f681469fbed357571f1c3eb.zip
vt-d: Fix PCI=device parsing.
Signed-off-by: Weidong Han <weidong.han@intel.com>
-rw-r--r--tools/ioemu/hw/pass-through.c8
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/tools/ioemu/hw/pass-through.c b/tools/ioemu/hw/pass-through.c
index b445291874..7dd9588ba0 100644
--- a/tools/ioemu/hw/pass-through.c
+++ b/tools/ioemu/hw/pass-through.c
@@ -39,11 +39,10 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
{
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, int *bus, int *dev, int *func)
*dev = token_value(token);
token = strchr(token, ',') + 1;
*func = token_value(token);
+ token = strchr(token, ',');
+ *str = token ? token + 1 : NULL;
- *str = token;
return 1;
}
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 4a2a64715e..6a2e848b0b 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -543,11 +543,10 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
{
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, int *bus, int *dev, int *func)
*dev = token_value(token);
token = strchr(token, ',') + 1;
*func = token_value(token);
+ token = strchr(token, ',');
+ *str = token ? token + 1 : NULL;
- *str = token;
return 1;
}