From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyKpB-0002vY-Pe for qemu-devel@nongnu.org; Fri, 17 Feb 2012 05:14:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyKpA-0000sb-HH for qemu-devel@nongnu.org; Fri, 17 Feb 2012 05:13:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyKpA-0000sI-3k for qemu-devel@nongnu.org; Fri, 17 Feb 2012 05:13:56 -0500 Date: Fri, 17 Feb 2012 12:13:57 +0200 From: "Michael S. Tsirkin" Message-ID: <20120217101355.GC31366@redhat.com> References: <20120217094255.GA31366@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 2/2] pci: rewrite devaddr parsing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org 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 [[:]:] */ > > > > + 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:av1474@comtv.ru