From nobody Fri May 3 11:55:52 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=1564502790; cv=none; d=zoho.com; s=zohoarc; b=gER4+mLgOl3fhsrvrDS8wOBXY6kkexF2zrsRMntccRKQ6uSmHOsH5nYiYaRKB6roO1r2/gy/B14OdfN3iEFPA9eiD+tAsC3hqlgmzc2fiSzhaDOCqIChv5oNtbfTfC1s1O+BPNbb0nZ12A08OClAV09lHOV/2pAHlarr8ucqJ5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564502790; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KAuRD3stRgXnmf3Z+FHgt+eRv81f8pSt61wmUBsYOSs=; b=XtqGJts158jGlxKlpsnYLZLxOuIPJJgQ//lkP7XnSbnhtzwGeubOyyvdOtR+JZCMW86DGwu0apQTNdSuopcGE0tnJs+Qe524TA0ZCM6D6+B7Dw/0XhPj4UYFYIGvDwsgjS1rU3IpMRsxosmYrxND3Ok7+N7V0Ka/k4r8+p22GIo= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564502790357404.51574015909637; Tue, 30 Jul 2019 09:06:30 -0700 (PDT) Received: from localhost ([::1]:34446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsUdw-0004gE-Uu for importer@patchew.org; Tue, 30 Jul 2019 12:06:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49228) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsUZd-0005Rt-RS for qemu-devel@nongnu.org; Tue, 30 Jul 2019 12:02:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsUZb-0005Zu-J0 for qemu-devel@nongnu.org; Tue, 30 Jul 2019 12:02:01 -0400 Received: from relay.sw.ru ([185.231.240.75]:53306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsUZZ-0005YA-Na; Tue, 30 Jul 2019 12:01:59 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hsUZS-0001RG-1s; Tue, 30 Jul 2019 19:01:50 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 30 Jul 2019 19:01:36 +0300 Message-Id: <1564502498-805893-2-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 1/3] test-throttle: Fix uninitialized use of burst_length X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vsementsov@virtuozzo.com, berto@igalia.com, ehabkost@redhat.com, kvm@vger.kernel.org, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, pbonzini@redhat.com, rth@twiddle.net 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" ThrottleState::cfg of the static variable 'ts' is reassigned with the local one in the do_test_accounting() and then is passed to the throttle_account() with uninitialized member LeakyBucket::burst_length. Signed-off-by: Andrey Shinkevich Reviewed-by: Alberto Garcia --- tests/test-throttle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test-throttle.c b/tests/test-throttle.c index a288122..ebf3aeb 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -557,6 +557,8 @@ static bool do_test_accounting(bool is_ops, /* are we t= esting bps or ops */ BucketType index; int i; =20 + throttle_config_init(&cfg); + for (i =3D 0; i < 3; i++) { BucketType index =3D to_test[is_ops][i]; cfg.buckets[index].avg =3D avg; --=20 1.8.3.1 From nobody Fri May 3 11:55:52 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=1564502852; cv=none; d=zoho.com; s=zohoarc; b=LrWjf7u+owdwMStpH6Gg+R0mIm+0T0qwE421hCfmlxxVsCdvmOzkaJSnGzWts74DgKXyPsx6D7zuFDjL+q613278OvnYB7w5WJeo5pfcRGZN87x1bjRknJais4kMCSIHxd7ILy/lv5wJhQNW0gjn1bpxlk9cQk4qgb23Ewzz3CA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564502852; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=nahQvsFEI/aeFnqd7tBVlZ5GPxiJZpgv/9KfhmWWwdY=; b=c5ct2Nxga13xA/EpMO5K3JidpOupom2nF6Mw2KZL4jO2aHxYjz3RedD8jTa8J0x7G8PsFfRZDLAhsMLCgNf0MRSwUWC7EyCsQHNVMDd+aD7J4jJ7ocKctXTQoB7PkzJ9tjphCPI6rdxiDhCLmF7khhlCU5br/5BzJ3SI/3ug+Yc= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564502852691549.8651800351798; Tue, 30 Jul 2019 09:07:32 -0700 (PDT) Received: from localhost ([::1]:34454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsUex-0005qk-Me for importer@patchew.org; Tue, 30 Jul 2019 12:07:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49223) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsUZd-0005Rr-OD for qemu-devel@nongnu.org; Tue, 30 Jul 2019 12:02:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsUZb-0005Zg-Hl for qemu-devel@nongnu.org; Tue, 30 Jul 2019 12:02:01 -0400 Received: from relay.sw.ru ([185.231.240.75]:53300) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsUZZ-0005Y9-M8; Tue, 30 Jul 2019 12:01:57 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hsUZS-0001RG-Fs; Tue, 30 Jul 2019 19:01:50 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 30 Jul 2019 19:01:37 +0300 Message-Id: <1564502498-805893-3-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 2/3] tests: Fix uninitialized byte in test_visitor_in_fuzz X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vsementsov@virtuozzo.com, berto@igalia.com, ehabkost@redhat.com, kvm@vger.kernel.org, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, pbonzini@redhat.com, rth@twiddle.net 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" One byte in the local buffer stays uninitialized, at least with the first iteration, because of the double decrement in the test_visitor_in_fuzz(). This is what Valgrind does not like and not critical for the test itself. So, reduce the number of the memory issues reports. Signed-off-by: Andrey Shinkevich --- tests/test-string-input-visitor.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-vi= sitor.c index 34b54df..5418e08 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -444,16 +444,14 @@ static void test_visitor_in_fuzz(TestInputVisitorData= *data, char buf[10000]; =20 for (i =3D 0; i < 100; i++) { - unsigned int j; + unsigned int j, k; =20 j =3D g_test_rand_int_range(0, sizeof(buf) - 1); =20 buf[j] =3D '\0'; =20 - if (j !=3D 0) { - for (j--; j !=3D 0; j--) { - buf[j - 1] =3D (char)g_test_rand_int_range(0, 256); - } + for (k =3D 0; k !=3D j; k++) { + buf[k] =3D (char)g_test_rand_int_range(0, 256); } =20 v =3D visitor_input_test_init(data, buf); --=20 1.8.3.1 From nobody Fri May 3 11:55:52 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=1564502730; cv=none; d=zoho.com; s=zohoarc; b=Sibx20NUGW2vva8w/2XEugMV9ssPQFYO6ljn38xf8VkYi9I7y72f4ldrsawfNPQxEk6nxgsedKdSE+rl7aMjI77B3Ki+L1Oo0pp6HA+5L14tFZXuNWPu914Hp6PWuS7IKz1qkVjiNOc/ZDLn5Up1AdqtZD8QE61c1Y9I/xWQGwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564502730; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=w+IU4FvHeRw1mg/uhkOHVYPdxAOIpgYLoMAtdc0gvZQ=; b=BYtkvMlM5UzGBfH4N7ylM0rp3eyZDUNJ7AmqYpEcjr3A9kaEuc1tZB5nj010wn/lHKw4AtMu13TB6aC973+gQvefrB8lWmJfpcUDiU/frCkzeK7ukUDPK1WOCklJ2hhLmp1M9v3MX2dUgUcH9mGWbLDqx7oCSBdQSd0zJnlJhZ8= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564502730553740.2671690036902; Tue, 30 Jul 2019 09:05:30 -0700 (PDT) Received: from localhost ([::1]:34404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsUcz-0001qD-JZ for importer@patchew.org; Tue, 30 Jul 2019 12:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49227) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsUZd-0005Rs-RH for qemu-devel@nongnu.org; Tue, 30 Jul 2019 12:02:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsUZb-0005Zm-Hz for qemu-devel@nongnu.org; Tue, 30 Jul 2019 12:02:01 -0400 Received: from relay.sw.ru ([185.231.240.75]:53310) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsUZZ-0005Y8-Mj; Tue, 30 Jul 2019 12:01:59 -0400 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hsUZT-0001RG-68; Tue, 30 Jul 2019 19:01:51 +0300 From: Andrey Shinkevich To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 30 Jul 2019 19:01:38 +0300 Message-Id: <1564502498-805893-4-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vsementsov@virtuozzo.com, berto@igalia.com, ehabkost@redhat.com, kvm@vger.kernel.org, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com, andrey.shinkevich@virtuozzo.com, den@openvz.org, pbonzini@redhat.com, rth@twiddle.net 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" Not the whole structure is initialized before passing it to the KVM. Reduce the number of Valgrind reports. Signed-off-by: Andrey Shinkevich Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/kvm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index dbbb137..ed57e31 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -190,6 +190,7 @@ static int kvm_get_tsc(CPUState *cs) return 0; } =20 + memset(&msr_data, 0, sizeof(msr_data)); msr_data.info.nmsrs =3D 1; msr_data.entries[0].index =3D MSR_IA32_TSC; env->tsc_valid =3D !runstate_is_running(); @@ -1706,6 +1707,7 @@ int kvm_arch_init_vcpu(CPUState *cs) =20 if (has_xsave) { env->xsave_buf =3D qemu_memalign(4096, sizeof(struct kvm_xsave)); + memset(env->xsave_buf, 0, sizeof(struct kvm_xsave)); } =20 max_nested_state_len =3D kvm_max_nested_state_length(); @@ -3477,6 +3479,7 @@ static int kvm_put_debugregs(X86CPU *cpu) return 0; } =20 + memset(&dbgregs, 0, sizeof(dbgregs)); for (i =3D 0; i < 4; i++) { dbgregs.db[i] =3D env->dr[i]; } --=20 1.8.3.1