From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWN1X-0003O1-6a for qemu-devel@nongnu.org; Sun, 28 Apr 2013 04:31:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWN1U-0006Ss-Mt for qemu-devel@nongnu.org; Sun, 28 Apr 2013 04:31:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWN1U-0006S8-Fd for qemu-devel@nongnu.org; Sun, 28 Apr 2013 04:31:52 -0400 Date: Sun, 28 Apr 2013 11:31:39 +0300 From: "Michael S. Tsirkin" Message-ID: <20130428083138.GC7106@redhat.com> References: <1366965244-20542-1-git-send-email-jasowang@redhat.com> <1366965244-20542-3-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1366965244-20542-3-git-send-email-jasowang@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] s390-virtio-bus: sync config only when config_len is not zero List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: aliguori@us.ibm.com, Richard Henderson , pmatouse@redhat.com, qemu-devel@nongnu.org, Alexander Graf On Fri, Apr 26, 2013 at 04:34:04PM +0800, Jason Wang wrote: > virtio-rng-s390 has zero config length, so no need to sync its config otherwise > qemu will crash since vdev->config is NULL. > > Cc: Alexander Graf > Cc: Richard Henderson > Signed-off-by: Jason Wang Actully, it validates get_config so what's the problem here? > --- > hw/s390x/s390-virtio-bus.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c > index dabbc2e..0f83516 100644 > --- a/hw/s390x/s390-virtio-bus.c > +++ b/hw/s390x/s390-virtio-bus.c > @@ -350,6 +350,10 @@ void s390_virtio_device_sync(VirtIOS390Device *dev) > dev->feat_offs = cur_offs + dev->feat_len; > cur_offs += dev->feat_len * 2; > > + if (!dev->vdev->config_len) { > + return; > + } > + > /* Sync config space */ > if (dev->vdev->get_config) { > dev->vdev->get_config(dev->vdev, dev->vdev->config); > -- > 1.7.1