[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [patch] Bugfix for tools/blktap/lib/xs_api.c (convert_dev_name_to_num)
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. Attachment:
xs_api-convert_dev_names_to_num_cleanup.diff _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |