From nobody Tue May 7 13:37:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1559132642; cv=none; d=zoho.com; s=zohoarc; b=kdwr07Zos1gJt3j+ytDrKcwlWqG1CYDMtvxhTig4pQc8o0m5T2UP6fmjJ1RRlIJ8KVDodqIL95HUv7qh+fd3cxO7DCK156SimtlbrQDgZfWuXGYrOS3KWr4lIannTlB6x89NDjuST9Alq5zB95I0lHoLgSQWX+53ISMCt7kU9nI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559132642; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=y2iG298IJF5X52wuJDsErz+eQ+aeAfIa34ZoV8KzEVY=; b=goOD4cKPdwC5AbzXSasz18l15hfmCE011wkKqujqTZhv70JeAlPUzf4Sh5cchlzhPezNrRZraA1/P81Q9j2Xsp8G0y7FkdXqaihAmispBHHLUZwaZfiONB41Q/ASky2K9asC2aah4F/BFSin68EfRH2cyP8sODKS7ZMRISTuuF8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559132642507565.5203261322147; Wed, 29 May 2019 05:24:02 -0700 (PDT) Received: from localhost ([127.0.0.1]:53441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVxbt-0003a2-Q4 for importer@patchew.org; Wed, 29 May 2019 08:23:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVxas-0003Dh-DA for qemu-devel@nongnu.org; Wed, 29 May 2019 08:22:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVxar-0002W5-JI for qemu-devel@nongnu.org; Wed, 29 May 2019 08:22:10 -0400 Received: from relay.sw.ru ([185.231.240.75]:35166) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVxar-0002Ud-D0; Wed, 29 May 2019 08:22:09 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hVxan-0003Qy-3f; Wed, 29 May 2019 15:22:05 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 29 May 2019 15:22:04 +0300 Message-Id: <1559132524-228613-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH] hw/block/fdc: floppy command FIFO memory initialization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, mreitz@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The uninitialized memory allocated for the command FIFO of the floppy controller during the VM hardware initialization incurs many unwanted reports by Valgrind when VM state is being saved. That verbosity hardens a search for the real memory issues when the iotests run. Particularly, the patch eliminates 20 unnecessary reports of the Valgrind tool in the iotest #169. Signed-off-by: Andrey Shinkevich --- hw/block/fdc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 6f19f12..54e470c 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2647,6 +2647,10 @@ static void fdctrl_realize_common(DeviceState *dev, = FDCtrl *fdctrl, =20 FLOPPY_DPRINTF("init controller\n"); fdctrl->fifo =3D qemu_memalign(512, FD_SECTOR_LEN); + if (fdctrl->fifo) { + /* To avoid using the uninitialized memory while saving VM state */ + memset(fdctrl->fifo, 0, FD_SECTOR_LEN); + } fdctrl->fifo_size =3D 512; fdctrl->result_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, fdctrl_result_timer, fdctrl); --=20 1.8.3.1