From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH 3/3] virtio: Define max_nr_ports to unsigned Date: Wed, 15 Jun 2011 23:39:26 +0300 Message-ID: <20110615203926.GC8362@redhat.com> References: <20110615142524.26726.13785.stgit@localhost6.localdomain6> <20110615142541.26726.42629.stgit@localhost6.localdomain6> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Amos Kong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34653 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755189Ab1FOUjL (ORCPT ); Wed, 15 Jun 2011 16:39:11 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5FKdBK0005967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 15 Jun 2011 16:39:11 -0400 Content-Disposition: inline In-Reply-To: <20110615142541.26726.42629.stgit@localhost6.localdomain6> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jun 15, 2011 at 10:25:41PM +0800, Amos Kong wrote: > hw/virtio-serial-bus.c: > 725 static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) > 726 { > ... > 730 int ret, max_nr_ports; > ... > 762 max_nr_ports = tswap32(port->vser->config.max_nr_ports); > 763 if (port->id >= max_nr_ports) { > > tswap32() returns an uint32_t variable. > > Signed-off-by: Amos Kong I guess 2^31 ports isn't really feasible, but it's good to be consistent. Acked-by: Michael S. Tsirkin > --- > hw/virtio-serial-bus.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > index 9a12104..aae8456 100644 > --- a/hw/virtio-serial-bus.c > +++ b/hw/virtio-serial-bus.c > @@ -727,7 +727,8 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) > VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev); > VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base); > VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus); > - int ret, max_nr_ports; > + int ret; > + uint32_t max_nr_ports; > bool plugging_port0; > > port->vser = bus->vser;