tools/xenstat: handle network interface name in uppercase.
PATCH 1/1 tools/xenstat: handle network interface name in uppercase.
xentop will segmentation fault in this case:
# ip link set eth1 down # ip link set eth1 name ETH # xentop
This patch will let xentop to handle all uppercase network interface name.
--- tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/xenstat/libxenstat/src/xenstat_linux.c +6 -2
@@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign/* Temporary/helper variables */ int ret;char *tmp; +char *tmp2;int i =0 , x =0 , col =0 ;regex_t r;regmatch_t matches[19 ];
@@ -221,8 +222,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign }else /* There were errors when parsing this directly in RE. strpbrk() helps */ -if (iface !=NULL ) -strcpy (iface,strpbrk (tmp,"abcdefghijklmnopqrstvuwxyz0123456789" )); +if (iface !=NULL ) { + tmp2 =strpbrk (tmp,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ); +if (tmp2 !=NULL ) +strcpy (iface, tmp2); + }memset (tmp,0 , matches[i].rm_eo - matches[i].rm_so); }
Signature · 7 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Could anyone have a look at this patch?
Thanks,
Zhigang
Quoted 30 lines · Zhigang Wang
xentop will segmentation fault in this case:
# ip link set eth1 down # ip link set eth1 name ETH # xentopThis patch will let xentop to handle all uppercase network interface name.
Signed-off-by Zhigang Wang <[email protected]>--- tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/xenstat/libxenstat/src/xenstat_linux.c +1
-0@@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign/* Temporary/helper variables */ int ret;char *tmp; +char *tmp2;int i =0 , x =0 , col =0 ;regex_t r;regmatch_t matches[19 ];@@ -221,8 +222,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign }else /* There were errors when parsing this directly in RE. strpbrk() helps */
tools/xenstat/libxenstat/src/xenstat_linux.c int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign · line 232
Quoted 10 lines
tools/xenstat/libxenstat/src/xenstat_linux.c +5
-2-if (iface !=NULL ) -strcpy (iface,strpbrk (tmp,"abcdefghijklmnopqrstvuwxyz0123456789" )); +if (iface !=NULL ) { + tmp2 =strpbrk (tmp,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ); +if (tmp2 !=NULL ) +strcpy (iface, tmp2); + }memset (tmp,0 , matches[i].rm_eo - matches[i].rm_so); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
I wasn't CC'ed so this fled my attention.
Quoted 26 lines · Zhigang Wang
xentop will segmentation fault in this case:
# ip link set eth1 down # ip link set eth1 name ETH # xentopThis patch will let xentop to handle all uppercase network interface name.
Signed-off-by Zhigang Wang <[email protected]>--- tools/xenstat/libxenstat/src/xenstat_linux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/xenstat/libxenstat/src/xenstat_linux.c +1
-0@@ -101,6 +101,7 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign/* Temporary/helper variables */ int ret;char *tmp; +char *tmp2;int i =0 , x =0 , col =0 ;regex_t r;regmatch_t matches[19 ];
tools/xenstat/libxenstat/src/xenstat_linux.c int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign · line 224
Quoted 3 lines
tools/xenstat/libxenstat/src/xenstat_linux.c +0
-0@@ -221,8 +222,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign }else /* There were errors when parsing this directly in RE. strpbrk() helps */
This line indicates the most proper fix is to fix the regexp used to also parse netdev name IMHO. That being said, there is no reason to block a valid fix.
tools/xenstat/libxenstat/src/xenstat_linux.c int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign · line 229
Quoted 7 lines
tools/xenstat/libxenstat/src/xenstat_linux.c +5
-2-if (iface !=NULL ) -strcpy (iface,strpbrk (tmp,"abcdefghijklmnopqrstvuwxyz0123456789" )); +if (iface !=NULL ) { + tmp2 =strpbrk (tmp,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ); +if (tmp2 !=NULL ) +strcpy (iface, tmp2); + }
Please limit the scope of tmp2, if you only need that here, declare it within this narrow scope please.
Wei.
Quoted 11 lines
tools/xenstat/libxenstat/src/xenstat_linux.c +0
-0memset (tmp,0 , matches[i].rm_eo - matches[i].rm_so); }Signature · 7 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 1/1 tools/xenstat: handle network interface name in uppercase.
xentop will segmentation fault in this case:
# ip link set eth1 down # ip link set eth1 name ETH # xentop
This patch will let xentop to handle all uppercase network interface name.
--- tools/xenstat/libxenstat/src/xenstat_linux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/xenstat/libxenstat/src/xenstat_linux.c +5 -2
@@ -219,8 +219,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign }else /* There were errors when parsing this directly in RE. strpbrk() helps */ -if (iface !=NULL ) -strcpy (iface,strpbrk (tmp,"abcdefghijklmnopqrstvuwxyz0123456789" )); +if (iface !=NULL ) { +char *tmp2 =strpbrk (tmp,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ); +if (tmp2 !=NULL ) +strcpy (iface, tmp2); + }memset (tmp,0 , matches[i].rm_eo - matches[i].rm_so); }
Signature · 7 lines
2.5.5 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 9 lines · Zhigang Wang
xentop will segmentation fault in this case:
# ip link set eth1 down # ip link set eth1 name ETH # xentopThis patch will let xentop to handle all uppercase network interface name.
Signed-off-by Zhigang Wang <[email protected]>
This fixes a real problem and is not possible to block the pushgate, so:
Quoted 25 lines
--- tools/xenstat/libxenstat/src/xenstat_linux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tools/xenstat/libxenstat/src/xenstat_linux.c +5
-2@@ -219,8 +219,11 @@ int parseNetDevLine(char *line, char *iface, unsigned long long *rxBytes, unsign }else /* There were errors when parsing this directly in RE. strpbrk() helps */ -if (iface !=NULL ) -strcpy (iface,strpbrk (tmp,"abcdefghijklmnopqrstvuwxyz0123456789" )); +if (iface !=NULL ) { +char *tmp2 =strpbrk (tmp,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ); +if (tmp2 !=NULL ) +strcpy (iface, tmp2); + }memset (tmp,0 , matches[i].rm_eo - matches[i].rm_so); }Signature · 1 line
2.5.5
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Wei Liu
AppliedQuoted 9 lines · Wei Liu
Quoted 8 lines · Zhigang Wang
xentop will segmentation fault in this case:
# ip link set eth1 down # ip link set eth1 name ETH # xentopThis patch will let xentop to handle all uppercase network interface name.
Quoted 8 lines
Quoted 1 line
Signed-off-by Zhigang Wang <[email protected]>Acked-by Wei Liu <[email protected]>This fixes a real problem and is not possible to block the pushgate, so:
Release-acked-by Wei Liu <[email protected]>
Applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel