From nobody Mon May 6 09:04:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564016112; cv=none; d=zoho.com; s=zohoarc; b=e7rC4ejm+Ae/jp+jXrzPlFWSlZwpVHRNBWv3lGrXkB+bILQdj5JvvzmooBpp3r45mTFfb3IyQTsKtmbkeEOJhJykOOxFOwXE2Vsg0NV8orOhFrMiWS4vmlf03rRS4cBoml804CUL2ayIsPJCPvRA5yCSgez+sz/isrg0GN8kzQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564016112; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=APKGjNsWrQygR4wNdRwNNMzcnSEm30avHAUIR4Q8Sys=; b=f1vtlOEKvfP38HC5jyLdpxUYmpxH+as/tKeW33RSKwhuHYziTTy7Pp8sendbspEx5drc4BNKELzBKHmL4eBDKUEC+tZacbcOjcm8j5v+PPn/A8Y0a415kplhAMce5PUtMhWQeuVMKCVAb/mEVE+G6RSqGkLrFvmIbIbcKWucjX0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1564016112795248.54552797999474; Wed, 24 Jul 2019 17:55:12 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hqS0q-00040K-RH; Thu, 25 Jul 2019 00:53:40 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hqS0o-00040D-P5 for xen-devel@lists.xenproject.org; Thu, 25 Jul 2019 00:53:38 +0000 Received: from mail-io1-xd44.google.com (unknown [2607:f8b0:4864:20::d44]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id a2f8740a-ae76-11e9-8980-bc764e045a96; Thu, 25 Jul 2019 00:53:37 +0000 (UTC) Received: by mail-io1-xd44.google.com with SMTP id s7so93461877iob.11 for ; Wed, 24 Jul 2019 17:53:37 -0700 (PDT) Received: from desktop.ice.pyrology.org (static-50-53-74-115.bvtn.or.frontiernet.net. [50.53.74.115]) by smtp.gmail.com with ESMTPSA id x22sm34036193ioh.87.2019.07.24.17.53.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 24 Jul 2019 17:53:36 -0700 (PDT) X-Inumbo-ID: a2f8740a-ae76-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YX+FKBPdP1PjCQoZtYI7M0YxcaORS6zDX4GQoo/2XSM=; b=r+AFtpa+QeYH2NnWS8+sosEcz6NoAZrkSZfV7oB7AczW5MTQjUAea4O2KU5pg2nwtB 8U6UY4Jxf849Nti1toSHr0GZNezP9EyraZ+WOplZDCHZXBgKIY037CrRmEcgfE0DLbev q506HF5mZ0OlQdUqaqCvQLlQ/ONz17RtMdDzLPhkFOIY9MSbipprGYWphtdUFa9W0eUM mkLFFS6idFCI9EqS9AsK77us7qJOVHJagW5gOllclWtWTra0lVmaIFMku+OLQZ9raXjo uw3QBO6EA/HCmv3QcXkR8FiFmQy0sFNZgg2r8wYO8h+/KCFBrgQd1naZWEDSnZM9VMWW GMxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YX+FKBPdP1PjCQoZtYI7M0YxcaORS6zDX4GQoo/2XSM=; b=uRrA8jPGed0JINGIeyQUnrddOMpI0+NmcLZ//TgojMjfhrWYGx/Idi06mPT0UFM/jY vAtH7Lo4B2Yq1gQVXeZnC5Mvbro6fUDDiV4q7FrY+bsQQaUzKSm1LxRUo0lduASWqU7s vWtQYDWtegKuC/9KsvyZlphsEVYgj+d2+YvCOCgOlh1gycG2ChkgA1Ed4hsDgfCRqaNe DbqJXXuoadOXR0XKf9sJTKLWABrBCnf0tn/ruEcImHPssrKEHgIFqflYXKeU9kDFdB0t rKpxvGw8OLMcYUIVBqlhP63kjEoZTpH1qLUvQ7vaAieToLrDUWSWVnqLh7wmvVRclrCA 9irw== X-Gm-Message-State: APjAAAWn0o15PdtHtbVo7jbYlRUyyBklT8wa9PVh8pvK8bayZVnqLesK OhsS5THlQNR7W8U2Ab2pgN7V4o6B X-Google-Smtp-Source: APXvYqwtK4ATIcT4LXzJAKzE3HjV1XVy66wmL8ULvfzwDAkd2e3IetvYfqy8tbyVApWm/03x/TYUGA== X-Received: by 2002:a5d:9858:: with SMTP id p24mr16123365ios.171.1564016016893; Wed, 24 Jul 2019 17:53:36 -0700 (PDT) From: christopher.w.clark@gmail.com To: xen-devel@lists.xenproject.org Date: Wed, 24 Jul 2019 17:53:26 -0700 Message-Id: <20190725005326.3553-1-christopher.w.clark@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH] tests/cpu-policy: fix format-overflow warning by null terminating strings X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Andrew Cooper , Ian Jackson , Christopher Clark , Jan Beulich , Roger Pau Monne MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Christopher Clark gcc 9.1.0 reports: | test-cpu-policy.c:64:18: error: '%.12s' directive argument is not a nul-t= erminated string [-Werror=3Dformat-overflow=3D] | 64 | fail(" Test '%.12s', expected vendor %u, got %u\n", | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | test-cpu-policy.c:20:12: note: in definition of macro 'fail' | 20 | printf(fmt, ##__VA_ARGS__); \ | | ^~~ | test-cpu-policy.c:64:27: note: format string is defined here | 64 | fail(" Test '%.12s', expected vendor %u, got %u\n", | | ^~~~~ | test-cpu-policy.c:44:7: note: referenced argument declared here | 44 | } tests[] =3D { | | ^~~~~ so increase the string array size by one character for the null string terminator and add another single char to the struct within the same union to balance it. Signed-off-by: Christopher Clark --- tools/tests/cpu-policy/test-cpu-policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-pol= icy/test-cpu-policy.c index ca3b8dd45f..c91408a93a 100644 --- a/tools/tests/cpu-policy/test-cpu-policy.c +++ b/tools/tests/cpu-policy/test-cpu-policy.c @@ -35,9 +35,10 @@ static void test_vendor_identification(void) { static const struct test { union { - char ident[12]; + char ident[13]; struct { uint32_t b, d, c; + char null_terminator; }; }; unsigned int vendor; --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel