From patchwork Wed Dec 2 12:04:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 40023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A897DB7BE1 for ; Thu, 3 Dec 2009 00:43:36 +1100 (EST) Received: from localhost ([127.0.0.1]:57701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFpUS-0000zh-Vj for incoming@patchwork.ozlabs.org; Wed, 02 Dec 2009 08:43:33 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFnxx-0004Sj-0M for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFnxs-0004Pr-8J for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:52 -0500 Received: from [199.232.76.173] (port=42927 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFnxr-0004Pn-U7 for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36822) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFnxr-0004DD-AP for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:47 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB2C5kX2014939 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Dec 2009 07:05:46 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB2C5ILG029769; Wed, 2 Dec 2009 07:05:45 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 2 Dec 2009 13:04:16 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org size_t changes between 32 and 64 bits, making it bad for a field that needs to be on the 'wire'. This value will never be near int32_t limit. Stored values are very small ints, it is backwards compatible Signed-off-by: Juan Quintela --- hw/virtio.c | 4 ++-- hw/virtio.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index bb93e8c..fd617ff 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -640,7 +640,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) qemu_put_8s(f, &vdev->isr); qemu_put_be16s(f, &vdev->queue_sel); qemu_put_be32s(f, &vdev->features); - qemu_put_be32(f, vdev->config_len); + qemu_put_sbe32s(f, &vdev->config_len); qemu_put_buffer(f, vdev->config, vdev->config_len); qemu_put_sbe32s(f, &vdev->num_pci_queues); @@ -697,7 +697,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f) qemu_get_8s(f, &vdev->isr); qemu_get_be16s(f, &vdev->queue_sel); qemu_get_be32s(f, &vdev->features); - vdev->config_len = qemu_get_be32(f); + qemu_get_sbe32s(f, &vdev->config_len); qemu_get_buffer(f, vdev->config, vdev->config_len); qemu_get_sbe32s(f, &vdev->num_pci_queues); diff --git a/hw/virtio.h b/hw/virtio.h index d849f44..f56f672 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -96,7 +96,7 @@ struct VirtIODevice uint8_t isr; uint16_t queue_sel; uint32_t features; - size_t config_len; + int32_t config_len; void *config; uint16_t config_vector; int nvectors;