From patchwork Fri Nov 30 15:50:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 152568 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3814546ljp; Fri, 30 Nov 2018 07:50:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ux/713e4S7o96p70zlQGT6dX83nkXxGys6mX8DX1CgvmHfkMN7X+CSVtrxFDF5IpxcWSa4 X-Received: by 2002:a63:6bc1:: with SMTP id g184mr5385637pgc.25.1543593057612; Fri, 30 Nov 2018 07:50:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543593057; cv=none; d=google.com; s=arc-20160816; b=rrW1LueunavSu/DPigT8uOGvYx7MLenE12nibvGxhl5rM9jA9N68sXPdyCxzdvctNm 4+G6PuWkfO/oMMJy3WrUEcZpXi5aGjIUMZ3TQcN8Mc4l3Zlt/WHGMS9sNm6Vup11UCy8 3q61lF/2Mzr/KiPGaC0VDigZV+aMUIfwdFFPSM5PfE0H3WLdAHVpfTF175dd9aYNLNSO rYD7ddvbALO5ZALtIj/+ctclxR5c43CHavkDcwNyfWEz2iAetWjTxhalY5tNqEPU8o/o XZq7wxKg72c3LzxDgvVkpbPDbi+LhRTiJoUWBmsilYhGBJ4vpAUYtYOzJlEsr9QZaB8R yi7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=dgKoBF9Jxn+eAhvEeWyp6QaYzSLDYzbvr/BcyuVPceA=; b=hQmmVnn6Kuo3NJLKx48sMHBCF5BZCGmTedAT95DPJrPWeHaULKeh0lcvL9WSB6GBoz 1P1J8gx6xGUJOSWIVbX5PqFi2fEnTSEDyUmTI68hTHyXTtrVR7fyZa05A3sXhOlzEoij PLFZSJUVK8gxOCNm57SzRp6NdLQoUF5/IpnWnYOR+4suwmywqPWuJzvWMvHDFvfWS0mR 4uxxsiXTWACSb0wGSm9CqfKnsYKLpYq3QDfH2RkDbp2Wrcs434ittIGJkAqwP/8nRtVM 13Sx52x1xcDhSbHxxlM9YKsodmzgBhp38lxLqCauTRyUFuUKbDyTibLabKld8Vi57Bdd Q45A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of piglit-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=piglit-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id m1si5155045pgm.194.2018.11.30.07.50.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:50:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of piglit-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of piglit-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=piglit-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 010536E62F; Fri, 30 Nov 2018 15:50:57 +0000 (UTC) X-Original-To: piglit@lists.freedesktop.org Delivered-To: piglit@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA6AD6E62F for ; Fri, 30 Nov 2018 15:50:55 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id c126so6173992wmh.0 for ; Fri, 30 Nov 2018 07:50:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=BTTg/pIkZT489+ffp7c05OfFzjfXjk7uNPHLgHesroU=; b=t2h/Z9FMUy7ky1PsqbbSkOxnXhn/eADzEd5qG5rMcdxfqkmldK6pP1yrcr0KVok9zI sxaO9QQ62NSg06uL6MX3PgJm5BzHBIIfvhOVXTccp2JGY+WiA4TKX8GKKauXJ8PM0Z7Q nbalfaNeBY2J5y6jX45p6lnXR8YD4aGoqhl94XK6F5E3EPvOEhwwHt+y8XaBGe/90jGi L4VxOOnyMDqGpyREdx2iV5R5mHQtEe5z5BAk0qDx02FFS+C+dhAvR4UzBYZ4Q5fV+gNU 14MSCG2kENxfaFmhXrTsECX7AB9r7W1wiGytFKuCOhU8OKN4DeDuPvxbhdnOOPmsYqg7 BzgA== X-Gm-Message-State: AA+aEWbuP+hWkke6k0yFymwN3/ijFfJIeXkF3AlEhxmo7I+yJg5PEPuX 1axW305de6JCO2CBeMhFJCjC7HhaLYc= X-Received: by 2002:a1c:ce0e:: with SMTP id e14mr6366498wmg.53.1543593054200; Fri, 30 Nov 2018 07:50:54 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id p5sm1755205wmh.16.2018.11.30.07.50.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 07:50:53 -0800 (PST) From: Ross Burton To: piglit@lists.freedesktop.org Date: Fri, 30 Nov 2018 15:50:51 +0000 Message-Id: <20181130155051.9249-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [Piglit] [PATCH V2] arb_texture_view: fix security format warnings X-BeenThere: piglit@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: piglit-bounces@lists.freedesktop.org Sender: "Piglit" If built with -Werror=format-security then Piglit fails to build: /tests/spec/arb_texture_view/rendering-layers-image.c:150:8: error: format not a string literal and no format arguments [-Werror=format-security] (desc)); \ ^~~~~~ In this case test->uniform_type is being turned into a string using snprintf() and then passed to piglit_report_subtest_result() which takes a format string, but GCC can't verify the format. As _subtest_report() takes a format string, we can just remove the snprintf() and let it construct the label. Also as X is used once and doesn't make the code clearer, just inline it. Signed-off-by: Ross Burton Reviewed-by: Eric Engestrom --- tests/spec/arb_texture_view/rendering-layers-image.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/spec/arb_texture_view/rendering-layers-image.c b/tests/spec/arb_texture_view/rendering-layers-image.c index 415b01657..86148075b 100644 --- a/tests/spec/arb_texture_view/rendering-layers-image.c +++ b/tests/spec/arb_texture_view/rendering-layers-image.c @@ -142,26 +142,19 @@ test_render_layers(const struct test_info *test) return pass; } -#define X(f, desc) \ - do { \ - const bool subtest_pass = (f); \ - piglit_report_subtest_result(subtest_pass \ - ? PIGLIT_PASS : PIGLIT_FAIL, \ - (desc)); \ - pass = pass && subtest_pass; \ - } while (0) - enum piglit_result piglit_display(void) { bool pass = true; for (int test_idx = 0; test_idx < ARRAY_SIZE(tests); test_idx++) { const struct test_info *test = &tests[test_idx]; - char test_name[128]; - snprintf(test_name, sizeof(test_name), "layers rendering of %s", test->uniform_type); - X(test_render_layers(test), test_name); + + const bool subtest_pass = test_render_layers(test); + + piglit_report_subtest_result(subtest_pass ? PIGLIT_PASS : PIGLIT_FAIL, + "layers rendering of %s", test->uniform_type); + pass = pass && subtest_pass; } -#undef X pass = piglit_check_gl_error(GL_NO_ERROR) && pass; return pass ? PIGLIT_PASS : PIGLIT_FAIL; }