From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVJoz-0007rr-4L for qemu-devel@nongnu.org; Fri, 28 Aug 2015 09:35:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVJow-0001fl-AC for qemu-devel@nongnu.org; Fri, 28 Aug 2015 09:35:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVJow-0001fb-53 for qemu-devel@nongnu.org; Fri, 28 Aug 2015 09:35:54 -0400 Date: Fri, 28 Aug 2015 14:35:50 +0100 From: "Daniel P. Berrange" Message-ID: <20150828133550.GQ28526@redhat.com> References: <57FA8C0D-64FF-4F71-8597-E36E0D1FF7E4@gmail.com> <1440762638.20725.0.camel@redhat.com> <22A8CA8A-8690-4670-93BC-096C96FB3950@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <22A8CA8A-8690-4670-93BC-096C96FB3950@gmail.com> Subject: Re: [Qemu-devel] [PATCH] hw/usb/bus.c: print device ID when 'info usb' used Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid Cc: Gerd Hoffmann , qemu-devel qemu-devel On Fri, Aug 28, 2015 at 09:08:12AM -0400, Programmingkid wrote: > > On Aug 28, 2015, at 7:50 AM, Gerd Hoffmann wrote: > > > On Mo, 2015-08-24 at 15:13 -0400, Programmingkid wrote: > >> + monitor_printf(mon, " Device %d.%d, Port %s, Speed %s > >> Mb/s," > >> + "Product %s, ID %s\n", > >> + bus->busnr, dev->addr, port->path, > >> + usb_speed(dev->speed), > >> + dev->product_desc, dev->qdev.id); > >> > > > > dev->qdev.id can be NULL. > > > > cheers, > > Gerd > > That isn't a problem. It will just say "null" when it is printed. > No crash or garbage text. Handling of '%s' with NULL is undefined by the standard. Linux glibc prints the string "null", but other implementations can crash. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|