On Fri, Feb 17, 2012 at 01:50:41PM +0400, malc wrote: > On Fri, 17 Feb 2012, Michael S. Tsirkin wrote: > > > On Thu, Feb 16, 2012 at 11:23:40PM +0400, malc wrote: > > > > +{ > > > > + unsigned dom, bus, slot, func; > > > > + int n = -1; > > > > + > > > > + /* Parse [[<domain>:]<bus>:]<slot> */ > > > > + sscanf(addr, "%x:%x:%x%n", &dom, &bus, &slot, &n); > > > > > > sscanf can fail. > > > > > > > + if (n == -1) { > > > > > > If it does n will stay -1. > > > > You are right. That does not, however, invalidate the points made > by Eric Blake.
Yes. But I think + sscanf(addr, "%8x:%8x:%8x%n", &dom, &bus, &slot, &n); addresses his points. > -- > mailto:av1...@comtv.ru