From patchwork Wed Nov 18 14:41:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saul Tamari X-Patchwork-Id: 61051 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAIEfG2T030746 for ; Wed, 18 Nov 2009 14:41:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757506AbZKROke (ORCPT ); Wed, 18 Nov 2009 09:40:34 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757500AbZKROke (ORCPT ); Wed, 18 Nov 2009 09:40:34 -0500 Received: from mail-bw0-f227.google.com ([209.85.218.227]:37272 "EHLO mail-bw0-f227.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757371AbZKROkd (ORCPT ); Wed, 18 Nov 2009 09:40:33 -0500 Received: by bwz27 with SMTP id 27so1189476bwz.21 for ; Wed, 18 Nov 2009 06:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=GLbilzIjB3y90cYu/WZA5zLacjgz0lTbF3W/G37DnJw=; b=YKN6r5eyuNKPIq4AUM7r0BDhmUaSV3Tp4wjq4TgwwlIaDrN2hQWwefkar5OIKFjXQG TUaxFTINJAVgHytiTQEmtmiHtxR/3XDtfhHXnLRYxs4VW8CEOanxps4nvKwtgF2tMPRN UZLNPYZHohccpMYOePtQXWlJiRFVIcsx848SA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=cXvzVt42/rn4qLZNUlFDnl3TbKxc/Qt+8IcT4kl6xU2JxxAR/VkrtOuO6e8MbsGu3I iC9AUPROpua25U6CGtLv0Bh1tSrA08v47C+igwHIGA3erYA7na5c72I1Or25ffaWptKN slENKs1g45IwQntCxO9UzmR3VFZKwAxHLmG7g= Received: by 10.204.150.66 with SMTP id x2mr1303041bkv.9.1258555238097; Wed, 18 Nov 2009 06:40:38 -0800 (PST) Received: from localhost.localdomain (smtp.tadsys.com [212.179.37.162]) by mx.google.com with ESMTPS id 15sm51429bwz.4.2009.11.18.06.40.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 18 Nov 2009 06:40:37 -0800 (PST) Date: Wed, 18 Nov 2009 16:41:22 +0200 From: Saul Tamari To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: Re: [PATCH] qemu-kvm: clear only essential parts of VirtIOBlockReq on object allocation - RESUBMIT Message-ID: <20091118144122.GC19099@localhost.localdomain> References: <41be791c0911091004x62d30fbey91ef730475ba3571@mail.gmail.com> <4B02FBE4.2060409@codemonkey.ws> MIME-Version: 1.0 Content-Disposition: inline; filename="patch0.patch" In-Reply-To: <4B02FBE4.2060409@codemonkey.ws> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 2630b99..de74b00 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -79,12 +79,13 @@ static inline void virtio_identify_template(struct virtio_blk_config *bc) typedef struct VirtIOBlockReq { VirtIOBlock *dev; - VirtQueueElement elem; struct virtio_blk_inhdr *in; struct virtio_blk_outhdr *out; struct virtio_scsi_inhdr *scsi; QEMUIOVector qiov; struct VirtIOBlockReq *next; + /* Members that need clearing, must be added prior to elem */ + VirtQueueElement elem; } VirtIOBlockReq; static void virtio_blk_req_complete(VirtIOBlockReq *req, int status) @@ -139,7 +140,8 @@ static void virtio_blk_flush_complete(void *opaque, int ret) static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) { - VirtIOBlockReq *req = qemu_mallocz(sizeof(*req)); + VirtIOBlockReq *req = qemu_malloc(sizeof(*req)); + memset(req, 0, offsetof(VirtIOBlockReq, elem.in_addr[0])); req->dev = s; return req; }