Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1800590rdb; Mon, 9 Oct 2023 03:31:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHokzBKvFBQCd5VGLSBX50uj+RHQo5ayQnCXVrz08bDIX+Wc0Oed/Ud/kB2qHMOmpcqLobI X-Received: by 2002:a17:90b:283:b0:276:696b:1dd9 with SMTP id az3-20020a17090b028300b00276696b1dd9mr16426020pjb.15.1696847471038; Mon, 09 Oct 2023 03:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696847471; cv=none; d=google.com; s=arc-20160816; b=pYJpDqikLM+xg3S6ySb6WP7hsUIQmQYc/AYqinigwvVz51bl0MuYG5GrMLigoQcvcR k18NheHVYMEHMJH6e/wFMXSKZfyQIL5Afza75yOBu67QjG1REnCFN/Z5uIVw36gHz8Ij oTlhzTXH5f0Nzaptc0bTVqHAGvAuQYej7j96B4T5E+bkaBHiw2YNIuKhzpB5tg+/in8z rYO5vsrpoqcNxTxncvInW9C8IxWqfqH+6tcjrFansY3J00JNRaX21Xv75MfHa6h3jJfI Z5paQhRQ0ebEC9gKmoMAvOjT7vX28vlj4+zUeflZXTaW/foD9okTbomdcki7fgOy4Rk4 B8hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=k7zfSLqYYUlPuFqvSLat4/V4p1SoMlFbkqHn32DEKR0=; fh=eT4EbwR5QkfUREm233PnEkHq9JZQLcXds8o2zsygus8=; b=fVKmAsfNuVjRycZQPDMt2p8cexUnn54SzwtrgLaF89VwRLQk98XVyNcBJCFyL8BFXq 07oJUM2LIQ366EshnShk9Mqzs792LooOy91QkZjS04Ow5FpFofBBpheRPyQGfnGXpSQd 1i9fXDeNc4+gTtstxJ1xKbTXeCH/SP97K7rAipRs5naxC/GmpOITsUMqybeQG3AdsAFX Y/JtiajMAUT+o8DnkFcGj0va9lEBKuFh8UWSKw41YF83ituVHKGHs76N8DhOgNU/V2+h QkkYALZg3yGd4T7GR7Da6/XxNoV+nJWOdwmQPI+GovCz70e7xflOSCackAP77WqBnFsx Vtxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Lti+4mbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l133-20020a633e8b000000b0054fdfd26dffsi9895310pga.337.2023.10.09.03.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Lti+4mbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5B3B8808D486; Mon, 9 Oct 2023 03:30:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345794AbjJIKaa (ORCPT + 99 others); Mon, 9 Oct 2023 06:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345781AbjJIKa3 (ORCPT ); Mon, 9 Oct 2023 06:30:29 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13D4AC5; Mon, 9 Oct 2023 03:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696847427; x=1728383427; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OMhrMk6H+hsf9008O1J15mQR51/WYPVUjbeah3bIryg=; b=Lti+4mbhqUmyRbF20HkcptRcwwNQRgYHG9pnvBtcUEaAYnQPMnckuaU1 qxfKVNp2OOjYwFdMrbzJ5iRHSylKSX/9ceUdoF72xKhMKGk3RGkfszCa+ Eek7YutFR3+kiqZjrgd6R272Tdl8/QAreovUXUKI0dpIJwlaHcebX5zkU Ztygz90HiHE5bbI60rHPsFzMil7UfQ+/l4cJaYdyROFr0PSTC9BL2uVIn 5uwoJ82yY2ZHKV8gltYMV5RC9Dnv4vAu4EErTVnq91/IfKeyKQcL5N0sP NZ/u+Q6R7+X7gvMgtlHScFQjc+Ha0GrYKGfkQvx7530tsRZqeHxlASxbE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10857"; a="2711575" X-IronPort-AV: E=Sophos;i="6.03,210,1694761200"; d="scan'208";a="2711575" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 03:30:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10857"; a="876753798" X-IronPort-AV: E=Sophos;i="6.03,210,1694761200"; d="scan'208";a="876753798" Received: from kkensic-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.30.239]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 03:30:20 -0700 From: Maciej Wieczor-Retman To: akpm@linux-foundation.org, christian@kellner.me, fenghua.yu@intel.com, keescook@chromium.org, ndesaulniers@google.com, coltonlewis@google.com, dmatlack@google.com, vipinsh@google.com, seanjc@google.com, brauner@kernel.org, pbonzini@redhat.com, shuah@kernel.org, hannes@cmpxchg.org, nphamcs@gmail.com, reinette.chatre@intel.com Cc: ilpo.jarvinen@linux.intel.com, linux-kselftest@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 0/8] Add printf attribute to kselftest functions Date: Mon, 9 Oct 2023 12:28:28 +0200 Message-ID: X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 03:30:45 -0700 (PDT) X-Spam-Level: ** Kselftest.h declares many variadic functions that can print some formatted message while also executing selftest logic. These declarations don't have any compiler mechanism to verify if passed arguments are valid in comparison with format specifiers used in printf() calls. Attribute addition can make debugging easier, the code more consistent and prevent mismatched or missing variables. Add a __printf() macro that validates types of variables passed to the format string. The macro is similarly used in other tools in the kernel. Add __printf() attributes to function definitions inside kselftest.h that use printing. Adding the __printf() macro exposes some mismatches in format strings across different selftests. Fix the mismatched format specifiers in multiple tests. Series is based on kselftests next branch. Changelog v4: - Fix patch 1/8 subject typo. - Add Reinette's reviewed-by tags. - Rebased onto updated kselftests next branch. Changelog v3: - Changed git signature from Wieczor-Retman Maciej to Maciej Wieczor-Retman. - Added one review tag. - Rebased onto updated kselftests next branch. Changelog v2: - Add review and fixes tags to patches. - Add two patches with mismatch fixes. - Fix missed attribute in selftests/kvm. (Andrew) - Fix previously missed issues in selftests/mm (Ilpo) [v3] https://lore.kernel.org/all/cover.1695373131.git.maciej.wieczor-retman@intel.com/ [v2] https://lore.kernel.org/all/cover.1693829810.git.maciej.wieczor-retman@intel.com/ [v1] https://lore.kernel.org/all/cover.1693216959.git.maciej.wieczor-retman@intel.com/ Maciej Wieczor-Retman (8): selftests: Add printf attribute to kselftest prints selftests/cachestat: Fix print_cachestat format selftests/openat2: Fix wrong format specifier selftests/pidfd: Fix ksft print formats selftests/sigaltstack: Fix wrong format specifier selftests/kvm: Replace attribute with macro selftests/mm: Substitute attribute with a macro selftests/resctrl: Fix wrong format specifier .../selftests/cachestat/test_cachestat.c | 2 +- tools/testing/selftests/kselftest.h | 18 ++++++++++-------- .../testing/selftests/kvm/include/test_util.h | 8 ++++---- tools/testing/selftests/mm/mremap_test.c | 2 +- tools/testing/selftests/mm/pkey-helpers.h | 2 +- tools/testing/selftests/openat2/openat2_test.c | 2 +- .../selftests/pidfd/pidfd_fdinfo_test.c | 2 +- tools/testing/selftests/pidfd/pidfd_test.c | 12 ++++++------ tools/testing/selftests/resctrl/cache.c | 2 +- tools/testing/selftests/sigaltstack/sas.c | 2 +- 10 files changed, 27 insertions(+), 25 deletions(-) base-commit: f1020c687153609f246f3314db5b74821025c185 -- 2.42.0