From patchwork Wed May 19 09:31:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 52967 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 09472B7D4E for ; Wed, 19 May 2010 19:31:12 +1000 (EST) Received: from localhost ([127.0.0.1]:37649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEfcK-0001lf-Vz for incoming@patchwork.ozlabs.org; Wed, 19 May 2010 05:31:09 -0400 Received: from [140.186.70.92] (port=41757 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OEfbM-0001l9-F9 for qemu-devel@nongnu.org; Wed, 19 May 2010 05:30:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OEfbL-00042i-5C for qemu-devel@nongnu.org; Wed, 19 May 2010 05:30:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34105) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OEfbK-00042E-UI for qemu-devel@nongnu.org; Wed, 19 May 2010 05:30:07 -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.13.8/8.13.8) with ESMTP id o4J9U3HZ005803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 May 2010 05:30:04 -0400 Received: from localhost (vpn-225-45.phx2.redhat.com [10.3.225.45]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4J9U0wD024909; Wed, 19 May 2010 05:30:01 -0400 From: Amit Shah To: Anthony Liguori Date: Wed, 19 May 2010 15:01:38 +0530 Message-Id: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Amit Shah , Alon Levy , qemu list Subject: [Qemu-devel] [PATCH] virtio-serial-bus: fix ports_map allocation on init 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 From: Alon Levy Fix for too small allocation to ports_map Signed-off-by: Alon Levy Signed-off-by: Amit Shah --- 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 3ce95e8..7f9d28f 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -774,7 +774,8 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports) } vser->config.max_nr_ports = max_nr_ports; - vser->ports_map = qemu_mallocz((max_nr_ports + 31) / 32); + vser->ports_map = qemu_mallocz(((max_nr_ports + 31) / 32) + * sizeof(vser->ports_map[0])); /* * Reserve location 0 for a console port for backward compat * (old kernel, new qemu)