|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [patch] Bugfix for tools/blktap/lib/xs_api.c (convert_dev_na
I rewrote function convert_dev_name_to_num from
tools/blktap/lib/xs_api.c
Difference:
All code in loops has been converted from ..perverted for+while code to
pure for. sizeof for char[]="..." will works faster, than
strlen(string), strange *pte++ have been removed, *p++ changed to p+1 in
function calls.
Second change more disputable: I change code:
ret = (majors[i/2]*256) + atoi(p);
to
ret = (majors[i/2]*256) + isdigit(p[1]) ? atoi(p) : 0;
I believe it will clear out undefined behavior to atoi when it called
with non-convertible value (like letter or \x0).
I have not access to commits to hg, so diff in attachment for freshest
xen-unstable.hg.
I think this patch can be apply to xen 3.4 too, where I found this bug
early.
---
wBR, George.
xs_api-convert_dev_names_to_num_cleanup.diff
Description: Text Data
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [patch] Bugfix for tools/blktap/lib/xs_api.c (convert_dev_name_to_num),
George Shuklin <=
|
|
|
|
|