From nobody Mon May 6 09:49:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496649679593645.7452514683231; Mon, 5 Jun 2017 01:01:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD54E4E4D1; Mon, 5 Jun 2017 08:01:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF16917243; Mon, 5 Jun 2017 08:01:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 613BA4BB7F; Mon, 5 Jun 2017 08:01:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5581G1D022485 for ; Mon, 5 Jun 2017 04:01:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 07F8D86D3D; Mon, 5 Jun 2017 08:01:16 +0000 (UTC) Received: from caroline.brq.redhat.com (dhcp129-198.brq.redhat.com [10.34.129.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8667D86D21 for ; Mon, 5 Jun 2017 08:01:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DD54E4E4D1 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DD54E4E4D1 From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 5 Jun 2017 10:01:10 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] Reset the whole stack in testutils X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Jun 2017 08:01:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The memset() was resetting only 30 bytes in the array (size of the array), but it is array of pointers. Since it is a static array, let's just reset it by its size. Found by gcc-7.1: testutils.c: In function 'virTestRun': testutils.c:243:13: error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=3Dmemset-elt-= size] memset(testAllocStack, 0, ARRAY_CARDINALITY(testAllocStack)); ^~~~~~ Signed-off-by: Martin Kletzander --- Pushed as trivial an also under the build-breaker rule. I'm still getting one more error in config.h that probably needs fixing in autoconf: ../config.h:2994:48: warning: this use of "defined" may not be portable [-W= expansion-to-defined] || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ Let me know if you know how I could help with that. tests/testutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testutils.c b/tests/testutils.c index 4fb2338bb1de..4b8cf79ef939 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -240,7 +240,7 @@ virTestRun(const char *title, for (i =3D start; i < end; i++) { bool missingFail =3D false; # ifdef TEST_OOM_TRACE - memset(testAllocStack, 0, ARRAY_CARDINALITY(testAllocStack)); + memset(testAllocStack, 0, sizeof(testAllocStack)); ntestAllocStack =3D 0; # endif virAllocTestOOM(i + 1, 1); -- 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list