From patchwork Fri Dec 10 17:33:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECCF4C43219 for ; Fri, 10 Dec 2021 17:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233408AbhLJRhF (ORCPT ); Fri, 10 Dec 2021 12:37:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244673AbhLJRhC (ORCPT ); Fri, 10 Dec 2021 12:37:02 -0500 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A79CC0617A1 for ; Fri, 10 Dec 2021 09:33:27 -0800 (PST) Received: by mail-ot1-x332.google.com with SMTP id h19-20020a9d3e53000000b0056547b797b2so10308118otg.4 for ; Fri, 10 Dec 2021 09:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MYhfIoJvlZ3UvjgjTfCOCi8477KYN3hMlQaW6RBS+ig=; b=af9yfAM2vzCaX+swy2klbMoSrH2tkjLgvNjPp0zQZByY6sB9n0hkrMVuGwo8y7p4sl iEWkYM32+PBDmuzOdK0fJYMVX7YbtQRe7QOqh9iRvdW29YJVTnwap6Ilz1qoldCsQCyH 0rote55FZD2B/vSw6df149TN+E2Br2fgnwzyc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MYhfIoJvlZ3UvjgjTfCOCi8477KYN3hMlQaW6RBS+ig=; b=b4s5jUvt4UF+nc+P5KVqKGLVnIwVVndsLZUijI9Tf88hMYX6/Pc3m9/Y/RGxl2f02k L9hWRRXzcQ/mhcrXYzt8RqRGY4rICS1o6Uipum7K6i9J6wiGxJLJNDh7wDgxqXnDWK86 L04KpRBqfKso4/Ju1y/WHFhTN1tZFAD/tbyR+JJKp47a/tu8SShua3CghTLPBb2ZUFTY tT63EEhdRx+MXGlbs2lrzohNopIEtayDJUE751Ftk+bYGQuXL/uWsloqz6ZXutTvDiNx Np/oN5gxGnZiLGIkJtyZ2otvhPexhe4YbQ9yuV1ld5S2TJha3ddtZeGZxiRkGwYQ8TwP 29hA== X-Gm-Message-State: AOAM530X59eVpT8tuluze1LZgf1tEPIuw/oVmUuIxPPU7Y5NkqBj0F1L iqzTSpExOAe41F9re9GEK9W9WA== X-Google-Smtp-Source: ABdhPJz+fdxZhcaBb0aXL1/U4YYsysQrmZmbnuOBIm+WLfQTPZbTuKYEVakW8zy1Ps1nYPL431Nd1w== X-Received: by 2002:a9d:69ce:: with SMTP id v14mr12130459oto.312.1639157606779; Fri, 10 Dec 2021 09:33:26 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:26 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/12] tools: fix ARRAY_SIZE defines in tools and selftests hdrs Date: Fri, 10 Dec 2021 10:33:11 -0700 Message-Id: <30585e0f0acfb523c6f7a93e0b916ae756e0c7e7.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org tools/include/linux/kernel.h and kselftest_harness.h are missing ifndef guard around ARRAY_SIZE define. Fix them to avoid duplicate define errors during compile when another file defines it. This problem was found when compiling selftests that include a header with ARRAY_SIZE define. ARRAY_SIZE is defined in several selftests. There are about 25+ duplicate defines in various selftests source and header files. Add ARRAY_SIZE to kselftest.h in preparation for removing duplicate ARRAY_SIZE defines from individual test files. Signed-off-by: Shuah Khan Reviewed-by: Kees Cook --- tools/include/linux/kernel.h | 2 ++ tools/testing/selftests/kselftest.h | 4 ++++ tools/testing/selftests/kselftest_harness.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index 3e8df500cfbd..9701e8307db0 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h @@ -92,7 +92,9 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); int scnprintf(char * buf, size_t size, const char * fmt, ...); int scnprintf_pad(char * buf, size_t size, const char * fmt, ...); +#ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#endif #define current_gfp_context(k) 0 #define synchronize_rcu() diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 8d50483fe204..f1180987492c 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -48,6 +48,10 @@ #include #include +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + /* define kselftest exit codes */ #define KSFT_PASS 0 #define KSFT_FAIL 1 diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index ae0f0f33b2a6..75164e23f036 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -671,7 +671,9 @@ #define EXPECT_STRNE(expected, seen) \ __EXPECT_STR(expected, seen, !=, 0) +#ifndef ARRAY_SIZE #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) +#endif /* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is * not thread-safe, but it should be fine in most sane test scenarios. From patchwork Fri Dec 10 17:33:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3B36C4167B for ; Fri, 10 Dec 2021 17:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241353AbhLJRhG (ORCPT ); Fri, 10 Dec 2021 12:37:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244706AbhLJRhD (ORCPT ); Fri, 10 Dec 2021 12:37:03 -0500 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF1EC0617A2 for ; Fri, 10 Dec 2021 09:33:28 -0800 (PST) Received: by mail-oi1-x22e.google.com with SMTP id be32so14113370oib.11 for ; Fri, 10 Dec 2021 09:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Om7A8iJx3nmhRt21+GcSVSh1CLYidC/pJOApyfAW7NA=; b=SjV4lPhUdKrmpRTjTbfve+d5B769d3IL84XjeCyYyIxveR1xklcF8EADqlliDHUpYJ Frpg+DqzjkTlT32YzOqef4iMfY3Joj/P40H2wHvWyCUffJ0BIvLT3lAq9spBCpTV9VqW fhqvSvrGrkeHAyMG2Gr2cDT7Go5Db+PPVzNi8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Om7A8iJx3nmhRt21+GcSVSh1CLYidC/pJOApyfAW7NA=; b=QqoH2xAxIh/juyoZhaA8jaAhpZnCJFJP72vPQV4MPjCMz8ggtCrrt+6sOnOiDhM22S t/A6PxyFbOSSsNEXR6eg0VmZXrMfVS9EQmDG9tJE9Ewffvj8VgP/8ADBSfYLl/rFS9rh FD5a6IauC2SGiJGYIYF+dNg/B689XMkwpnl8pPEMr9mTM1QIAMrB53bpkMlm7RUf10Pi r+7aXGZCDW7b9Os6EEdKkMVt17qFwooPQb0+3sWnip/iEgc+sWmNao/E8GvzsaCgOJJh a1gWOKZs9Am2y8qIBJghVG8TdfZ3KYpE0p6FdMTUJHT5y/H8AsN2/vz8XQ7jYvx0lJCp SE/Q== X-Gm-Message-State: AOAM532gK2bJjbN2X5vUextMOUs0rn6UU8hXd1DML2Gqfbm3Gm1xvv+p YB3yHv8hJQT44GRNSvnCQ22RPA== X-Google-Smtp-Source: ABdhPJw1xkTM0IGWbm2xBQvRbX572S/iV1SuoJVNLe1QtOfW6SfMXVYKCvQz8AqfVuAHR9tlpezb4g== X-Received: by 2002:a05:6808:1a02:: with SMTP id bk2mr13567633oib.52.1639157607755; Fri, 10 Dec 2021 09:33:27 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:27 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/12] selftests/arm64: remove ARRAY_SIZE define from vec-syscfg.c Date: Fri, 10 Dec 2021 10:33:12 -0700 Message-Id: <7f6d7252af5c8efda140b6b5f626b9e5a267016a.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from vec-syscfg.c and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan Acked-by: Will Deacon --- tools/testing/selftests/arm64/fp/vec-syscfg.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index 272b888e018e..c90658811a83 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -21,8 +21,6 @@ #include "../../kselftest.h" #include "rdvl.h" -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - #define ARCH_MIN_VL SVE_VL_MIN struct vec_data { From patchwork Fri Dec 10 17:33:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81984C43217 for ; Fri, 10 Dec 2021 17:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241395AbhLJRi4 (ORCPT ); Fri, 10 Dec 2021 12:38:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244733AbhLJRhE (ORCPT ); Fri, 10 Dec 2021 12:37:04 -0500 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5358EC061746 for ; Fri, 10 Dec 2021 09:33:29 -0800 (PST) Received: by mail-ot1-x331.google.com with SMTP id i5-20020a05683033e500b0057a369ac614so10286754otu.10 for ; Fri, 10 Dec 2021 09:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gk7892EwBeQtmWfsZIAYujFfNQTmGWtEjgsjRv69+2g=; b=cLDJy7RNXkPVErf7+3pf0+bZ3jiuNMCjfkw3gOiwUaBeQdzuD8ZZ1Uyk7KdyZ6E3xp RKmfI7bq+6mGVljth/QC8Cfr74lIcmqnuNiEg9nlkAeFPl9jwYm93xx09FxNLnzAS3md xU6p7pqzKYbFQQDoiFq/PwNxoFT6afSbfUla4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gk7892EwBeQtmWfsZIAYujFfNQTmGWtEjgsjRv69+2g=; b=XEgu846QAeiBh2wHaHCvAREIghd/CZz/Iv5gnNd5iiG+L4f54UxKC70LPItR4IwPYl ubOBffeWE1XVC7lxfzItr0pF8d+E+Ht5a+txSomGgfzwpgOln/EP1Kl+mELpMUG6ioN9 H4s3n6AhAKFuTS+b2n0sijGKiS3v2e0zrrRmTzijaq0LUvuUzz7xvu9pFnBc4+LCNpTa wKfseA0xdWEEaZY+Q+XbDTt2XRNPkDVuo0OLXSuZLGz0vE+LUCYZ8r8qsimXp58BVEo/ Qw3Kv7RhwIlikDUpS7h/bJ6PPJm8C4NecX6ZphSBOnRMbIbGB9D6RbSHysU4z9c/GT5A UX9A== X-Gm-Message-State: AOAM533TUpCw+usEnJa/9ZKt4WZxoqB/AdVxW2ur4lIP+3U8QyguK56V 8hldweOKN5ztzoZzyPlYrMtrvA== X-Google-Smtp-Source: ABdhPJy8XksdNtBxn0PbE6EqXjHVZ9t/h8g8/JvDVwy45IUv5fD/F1510mJLv+/gSB4O0/zZ2hb6RA== X-Received: by 2002:a05:6830:4391:: with SMTP id s17mr12125024otv.118.1639157608654; Fri, 10 Dec 2021 09:33:28 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:28 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/12] selftests/cgroup: remove ARRAY_SIZE define from cgroup_util.h Date: Fri, 10 Dec 2021 10:33:13 -0700 Message-Id: <093209c9eb91462a6d9d0080112379c78d18a33c.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from cgroup_util.h and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/cgroup/cgroup_util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/cgroup/cgroup_util.h b/tools/testing/selftests/cgroup/cgroup_util.h index 82e59cdf16e7..4f66d10626d2 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.h +++ b/tools/testing/selftests/cgroup/cgroup_util.h @@ -2,9 +2,9 @@ #include #include -#define PAGE_SIZE 4096 +#include "../kselftest.h" -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#define PAGE_SIZE 4096 #define MB(x) (x << 20) From patchwork Fri Dec 10 17:33:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BBA5C41535 for ; Fri, 10 Dec 2021 17:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241390AbhLJRhH (ORCPT ); Fri, 10 Dec 2021 12:37:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244759AbhLJRhF (ORCPT ); Fri, 10 Dec 2021 12:37:05 -0500 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A705C061746 for ; Fri, 10 Dec 2021 09:33:30 -0800 (PST) Received: by mail-ot1-x32b.google.com with SMTP id x43-20020a056830246b00b00570d09d34ebso10345037otr.2 for ; Fri, 10 Dec 2021 09:33:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NDgcHDpgiGWK9Ew3NHUhEO9yqNh1ILLLayqUXO2p75w=; b=RBvRuhdbY7g+jhhycOa6s6AnQRPB9u+jMTQAdWAGcbZry4Gs71DzkZXrtyFNlzrjYb t6cYRkjUJNJA0VqVa9VD5NUujJb9jkn5OXNmdw0ZBi1zYANnBFWUCoJvVfZtk5h4sJn1 eqbzyIxoNgJ2evkyeFqyx5i3WODR+TVyV1f2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NDgcHDpgiGWK9Ew3NHUhEO9yqNh1ILLLayqUXO2p75w=; b=w0RGwci8qn75eXOaxUL6A273yNF0PQIMP4BuCZwN+pIBo8C6+NAZgtO+VELt/ZeQRO RL2l+rCFwu37z/LQilAfSFsci0cfF9/zTuNGNAdlfvFXjvum+GY7v+yH6x8qwSJ2UU5P i205J5nuGb1jGnoObm2jn1DVtHhqk752bRCCsxQdYld5S7mGya9mgmtQM2LegztbVBAo zNYDy6BOGdGgQgBtGVDjQz8VNHagF/aAeUDehLDu3JGPTxx+/J9/AYntpnvUlYp1D7v8 UDBYSd1t4kiemaOo/ji0lizCNiYR1m3vI7+u3uqHGHwCuV1YQdMSdlms065Cij+IUTJj /qfw== X-Gm-Message-State: AOAM531/Omxeur6ef5v774IJEax2YyTCC71qT6lod+4tEsYniknYrEBQ v6EJed4ul0LgyPCIxWA12oRqew== X-Google-Smtp-Source: ABdhPJyA4yaTBTIyZO1xnTM+/bAUFXSJizFV+09oAtmwLgPNp33uTLG6kCjRdELfrCYBpviWIZftqA== X-Received: by 2002:a05:6830:118a:: with SMTP id u10mr11939448otq.194.1639157609588; Fri, 10 Dec 2021 09:33:29 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:29 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/12] selftests/core: remove ARRAY_SIZE define from close_range_test.c Date: Fri, 10 Dec 2021 10:33:14 -0700 Message-Id: <0b20692e28c83822bb6b56518791371120582d0e.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from close_range_test.c and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/core/close_range_test.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/testing/selftests/core/close_range_test.c b/tools/testing/selftests/core/close_range_test.c index aa7d13d91963..749239930ca8 100644 --- a/tools/testing/selftests/core/close_range_test.c +++ b/tools/testing/selftests/core/close_range_test.c @@ -50,10 +50,6 @@ static inline int sys_close_range(unsigned int fd, unsigned int max_fd, return syscall(__NR_close_range, fd, max_fd, flags); } -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#endif - TEST(core_close_range) { int i, ret; From patchwork Fri Dec 10 17:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBED3C433FE for ; Fri, 10 Dec 2021 17:33:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241499AbhLJRhI (ORCPT ); Fri, 10 Dec 2021 12:37:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241342AbhLJRhG (ORCPT ); Fri, 10 Dec 2021 12:37:06 -0500 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B73C0617A2 for ; Fri, 10 Dec 2021 09:33:31 -0800 (PST) Received: by mail-ot1-x32c.google.com with SMTP id x3-20020a05683000c300b0057a5318c517so10257394oto.13 for ; Fri, 10 Dec 2021 09:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uh/Z9FDGr3qAAzEx+UXrnnj7QMHTF1v60adwa/WDWsE=; b=QvxE5B8BPn73UwnQSq14JPyQUVNaNUdzJIk09czGGhqGyoNq67Gtxk3CzYxR01hbht xtbSOHY32W87o9On8opuVK6zWIF+ANh7V/TPVN/bXzmOht/nwv8Fe+7n2kGi6lBbGAX0 4aIaRtWSG8tsp1iF8NMv6Vq3Ozl9ooZRMar7o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uh/Z9FDGr3qAAzEx+UXrnnj7QMHTF1v60adwa/WDWsE=; b=x/JsZBhGNliHzpkc7wEJP4iHjsAVhvwAE1bI9jyI4waEMnDLigNBAprBJY+Qfl6TDa QefrAGjtLZOVhrs6qhja6q0oWYN/iA/CseCy3Tf5AjxxFID7biJ1C1c07rxisdhhaMA/ JUQq71e/B5X0jW9EOXpeE4HLME2JsAtKrtloWZ1ZRB2BC9rJeIGm+uXuloLLn8UYath6 U1mHiOcYDRk5fzu3lwSTuBVQIVh2oYhEsGAZ/sRtxEMyBh4BWTFavnaeLc8K5WkH1UEt 5hRIboI4HFhDQGGBtlhYL7yz/xMNTNp88dvNRum13IeGyCLGRQRyZl3oUbipXh3xITgK J0/A== X-Gm-Message-State: AOAM531ZsotKa82BO3UVpVSidiGHAUjGKbscREhu5PjbJROkXdQFBtzo 0sEsQ4hUFYd0Z1btvhNTO3zdDg== X-Google-Smtp-Source: ABdhPJx4YSaRrvZVxbri/pWyy+QD/g1KBhe+XS0kuK/s8ZRC/VWuwyewAD6/3CwmIMT4Ovj4Oe4jIQ== X-Received: by 2002:a9d:8c2:: with SMTP id 60mr12177010otf.174.1639157610565; Fri, 10 Dec 2021 09:33:30 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:30 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/12] selftests/ir: remove ARRAY_SIZE define from ir_loopback.c Date: Fri, 10 Dec 2021 10:33:15 -0700 Message-Id: <019379a12759bf5b3f14cf66c5e8742cc71bced3.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from ir_loopback.c and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/ir/ir_loopback.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/ir/ir_loopback.c b/tools/testing/selftests/ir/ir_loopback.c index af7f9c7d59bc..06256c96df12 100644 --- a/tools/testing/selftests/ir/ir_loopback.c +++ b/tools/testing/selftests/ir/ir_loopback.c @@ -26,7 +26,6 @@ #include "../kselftest.h" #define TEST_SCANCODES 10 -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define SYSFS_PATH_MAX 256 #define DNAME_PATH_MAX 256 From patchwork Fri Dec 10 17:33:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE9C8C433FE for ; Fri, 10 Dec 2021 17:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244297AbhLJRhO (ORCPT ); Fri, 10 Dec 2021 12:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241422AbhLJRhH (ORCPT ); Fri, 10 Dec 2021 12:37:07 -0500 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61F05C061746 for ; Fri, 10 Dec 2021 09:33:32 -0800 (PST) Received: by mail-ot1-x331.google.com with SMTP id x19-20020a9d7053000000b0055c8b39420bso10351593otj.1 for ; Fri, 10 Dec 2021 09:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WMqa61IMKQAN9nayBNaET9ogW/1IQBHwCkgxPK83A3s=; b=ZiinzdUTAUE4pW3+MikJK5J7ul2KgoWPeStbJcIb4f+ObGuAEAF6SL+SMRMxnX95h2 iK95itksi/1uauaJqsD/x6K8C5VGuaLthvLoxR2o9n0klTF4wkcseELo0XrgDCp4GWPa /qWqBFehtViF2vhi7zRNmscMQ1Z5b/aeYT60o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WMqa61IMKQAN9nayBNaET9ogW/1IQBHwCkgxPK83A3s=; b=0zJbRk7GNx4OeWc5uctkm7sxSuysPRH59LqLDUsUwweiQ5Raxiz6pal16jgUOfF8Hu kXmVz/5PFHmfdV8GWg5LmKrheIJklgKuaaMCJS53/aCHFLy7gfmzXbRBLebNyCBLgz7o DBR2Faki3UtFKXBpA2bjGqXuN2zm7a1tRXnavpKuO8WbUWuAAsyFDH9qhMOn2sq2CiAR ew1ceL+3nAlt4N5m1YrOQ8X5rLE6N+AUz91SMZrcxbZZV+l5O1VGd1y6EXMUUDYS18+x SrRdzKRiMScKqJfhpVW4RB7uWbj8BbN+MwhLbUCZKwFkEgpqorhXo/XLLD0/NC2L9he9 Psig== X-Gm-Message-State: AOAM5326f5nnHWN82zBO0n8qmA4UjOJ4AltThp34kySUUm0JNYUSSjii MpaX1IKlSa/LBg59Rw1CgMkANE2NBAcAlA== X-Google-Smtp-Source: ABdhPJxs5UyjzAwtor6CH4V3zYGHQWLFyg/yw499Ss2tuG45t4WeD25Up32eMNTOXvKpzS2SfYHVjw== X-Received: by 2002:a05:6830:1392:: with SMTP id d18mr11833207otq.374.1639157611625; Fri, 10 Dec 2021 09:33:31 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:31 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/12] selftests/landlock: remove ARRAY_SIZE define from common.h Date: Fri, 10 Dec 2021 10:33:16 -0700 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from common.h and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan Acked-by: Mickaël Salaün --- tools/testing/selftests/landlock/common.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/testing/selftests/landlock/common.h b/tools/testing/selftests/landlock/common.h index 20e2a9286d71..183b7e8e1b95 100644 --- a/tools/testing/selftests/landlock/common.h +++ b/tools/testing/selftests/landlock/common.h @@ -17,10 +17,6 @@ #include "../kselftest_harness.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#endif - /* * TEST_F_FORK() is useful when a test drop privileges but the corresponding * FIXTURE_TEARDOWN() requires them (e.g. to remove files from a directory From patchwork Fri Dec 10 17:33:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670429 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87DA3C433FE for ; Fri, 10 Dec 2021 17:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244586AbhLJRhZ (ORCPT ); Fri, 10 Dec 2021 12:37:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241342AbhLJRhM (ORCPT ); Fri, 10 Dec 2021 12:37:12 -0500 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504F6C061A72 for ; Fri, 10 Dec 2021 09:33:33 -0800 (PST) Received: by mail-ot1-x330.google.com with SMTP id x43-20020a056830246b00b00570d09d34ebso10345161otr.2 for ; Fri, 10 Dec 2021 09:33:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/nnwsniEu8uqYxjrwTyGxxsdhf651m9rl/Wv8zBibbw=; b=SmXM3bXqM0gP1T/ezve3OJ9V/UwR0HRmCygo4+nqyzJjP1gF+zR7fge5vblTzlNrCX w04iFxqxd77ZVX79QZ2Zt1uJoQN9tDojIGVstIdl1Ce1fS/SMZQYXDALiC1835irYpPi EhPQEF96/sDzUgJbQgTPDroDn8RrRbvtb3geQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/nnwsniEu8uqYxjrwTyGxxsdhf651m9rl/Wv8zBibbw=; b=sYcI7zpZEsUAXsnyz8rMIPZ7ponWHtwk03lKnd9Os7wc1r7+d9EDkf5MI5ygr0S04Y 0WZsCvRXv7uS0gDU4PQ9DANnezk2DHUi6OuvJgZZ2LSl/IsEq0l8QLAGjBmbrcKatXHf F4fwA3Hj3GRpnczmZc+AQKa7sfboB3Xb0ilAIoGPLugTypyrrNH/pSZttjTkkq5fNKYw LeH12VVu2TJxRTlynfNnfXe+jJMvmk1oq8dty+nzsFlKsD8pzAM3+EXZ7DkC2YhDxdFs /a9MoyPd+GRmfYvjxDeLWTx8GWHenwZFoL0AtcSbZ/i1noea4yYDFHooynLDD/KSqo/C VnbQ== X-Gm-Message-State: AOAM532vc9/nH71mBQyTBsVbRAnG5RUkkwcVh0l3cRWWx04qdq+8m0wT UTbGbl4IlzmJXqrhB3CyBU0XOw== X-Google-Smtp-Source: ABdhPJw9KMAr8iR7/gO1NKMOwvgOgpBIMplkuY0P/9SLX80+FALZ7l62v8z8IlRFbsoMk0FcxwUIOQ== X-Received: by 2002:a9d:ea6:: with SMTP id 35mr11764702otj.304.1639157612590; Fri, 10 Dec 2021 09:33:32 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:32 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 07/12] selftests/net: remove ARRAY_SIZE define from individual tests Date: Fri, 10 Dec 2021 10:33:17 -0700 Message-Id: <1356c830b8155ddd37a6330c1f5d4df7a1bdb86a.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from net tests and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan Acked-by: Jakub Kicinski --- tools/testing/selftests/net/gro.c | 3 ++- tools/testing/selftests/net/ipsec.c | 1 - tools/testing/selftests/net/reuseport_bpf.c | 4 +--- tools/testing/selftests/net/rxtimestamp.c | 2 +- tools/testing/selftests/net/socket.c | 3 ++- tools/testing/selftests/net/tcp_fastopen_backup_key.c | 6 ++---- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c index cf37ce86b0fd..221525ccbe1d 100644 --- a/tools/testing/selftests/net/gro.c +++ b/tools/testing/selftests/net/gro.c @@ -57,10 +57,11 @@ #include #include +#include "../kselftest.h" + #define DPORT 8000 #define SPORT 1500 #define PAYLOAD_LEN 100 -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define NUM_PACKETS 4 #define START_SEQ 100 #define START_ACK 100 diff --git a/tools/testing/selftests/net/ipsec.c b/tools/testing/selftests/net/ipsec.c index 3d7dde2c321b..cc10c10c5ed9 100644 --- a/tools/testing/selftests/net/ipsec.c +++ b/tools/testing/selftests/net/ipsec.c @@ -41,7 +41,6 @@ #define pr_err(fmt, ...) printk(fmt ": %m", ##__VA_ARGS__) -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #define IPV4_STR_SZ 16 /* xxx.xxx.xxx.xxx is longest + \0 */ diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c index b5277106df1f..072d709c96b4 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -24,9 +24,7 @@ #include #include -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -#endif +#include "../kselftest.h" struct test_params { int recv_family; diff --git a/tools/testing/selftests/net/rxtimestamp.c b/tools/testing/selftests/net/rxtimestamp.c index e4613ce4ed69..9eb42570294d 100644 --- a/tools/testing/selftests/net/rxtimestamp.c +++ b/tools/testing/selftests/net/rxtimestamp.c @@ -18,7 +18,7 @@ #include #include -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#include "../kselftest.h" struct options { int so_timestamp; diff --git a/tools/testing/selftests/net/socket.c b/tools/testing/selftests/net/socket.c index afca1ead677f..db1aeb8c5d1e 100644 --- a/tools/testing/selftests/net/socket.c +++ b/tools/testing/selftests/net/socket.c @@ -7,6 +7,8 @@ #include #include +#include "../kselftest.h" + struct socket_testcase { int domain; int type; @@ -31,7 +33,6 @@ static struct socket_testcase tests[] = { { AF_INET, SOCK_STREAM, IPPROTO_UDP, -EPROTONOSUPPORT, 1 }, }; -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define ERR_STRING_SZ 64 static int run_tests(void) diff --git a/tools/testing/selftests/net/tcp_fastopen_backup_key.c b/tools/testing/selftests/net/tcp_fastopen_backup_key.c index 9c55ec44fc43..c1cb0c75156a 100644 --- a/tools/testing/selftests/net/tcp_fastopen_backup_key.c +++ b/tools/testing/selftests/net/tcp_fastopen_backup_key.c @@ -26,6 +26,8 @@ #include #include +#include "../kselftest.h" + #ifndef TCP_FASTOPEN_KEY #define TCP_FASTOPEN_KEY 33 #endif @@ -34,10 +36,6 @@ #define PROC_FASTOPEN_KEY "/proc/sys/net/ipv4/tcp_fastopen_key" #define KEY_LENGTH 16 -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -#endif - static bool do_ipv6; static bool do_sockopt; static bool do_rotate; From patchwork Fri Dec 10 17:33:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF03FC433EF for ; Fri, 10 Dec 2021 17:33:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244537AbhLJRh0 (ORCPT ); Fri, 10 Dec 2021 12:37:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241395AbhLJRhM (ORCPT ); Fri, 10 Dec 2021 12:37:12 -0500 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A61C061D5F for ; Fri, 10 Dec 2021 09:33:34 -0800 (PST) Received: by mail-ot1-x333.google.com with SMTP id x43-20020a056830246b00b00570d09d34ebso10345199otr.2 for ; Fri, 10 Dec 2021 09:33:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4WzsD+UFVzLiH0Fp9HCyUMze55/PXfN1Fv5h1c0wwoc=; b=Qchokgi1K6EjNENIB16rZTHkLbnhJuZXljqbd4G55iiZmPcNdBVkeVbMowdmC9q4qj uM+vvJsP1r/+NUFhjZ04YGOlvj7dYAlIu5fXxMAi7Vp8riHsOdb9yTNfCIZhxOzmilUN fYlr3CYWkIhW0u0R7l+00dYGvA8bO+xcWIlrg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4WzsD+UFVzLiH0Fp9HCyUMze55/PXfN1Fv5h1c0wwoc=; b=bG1TvDLpxli7sBLq0Y/EFAy5V25BwNztV7jsGAIOL8lCI+be1V/NdzuKTq1Vc2LgKY ODSLjjgkKk5sVWdeOILZDplDskVXJFQ/0EKfsICzJAC71VIMJ1m+w4aVrd+JSgxFNk0k G89mU/dul87QPUBEqtbRG+8IfR9fY8PqUolCzbqk9F2pm30yekb9rUhtrTQuhMyO1pam 494p+CvSx8mnLsgbyGSB7yYCoUwb9R3rHVWC9b71w0GW2q3YAEdZ2GEozB5ALstBTNa2 n2CwvtJvzTHdoqo2PhVhCmuUEIK5njQgw8L9T26FHLdc0gqOCHNw1qmG0/km4S9tG6Al Ufeg== X-Gm-Message-State: AOAM533ymV6omDSwzucNwt6NU8Pul6xsUui2cmcLPITMnBAtaSiXSPAV 1Z4QZwiUSC/WueZvT2D/fUpnIg== X-Google-Smtp-Source: ABdhPJyxsZn85HCQXDC0NYZWNPCIdku6oxp+hW2STbG5C8HyB1dqb+FYA6EOrK7FlkRbQQsZUFS6ug== X-Received: by 2002:a9d:373:: with SMTP id 106mr12125638otv.127.1639157613531; Fri, 10 Dec 2021 09:33:33 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:33 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/12] selftests/rseq: remove ARRAY_SIZE define from individual tests Date: Fri, 10 Dec 2021 10:33:18 -0700 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from rseq tests and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/rseq/basic_percpu_ops_test.c | 3 +-- tools/testing/selftests/rseq/rseq.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/rseq/basic_percpu_ops_test.c b/tools/testing/selftests/rseq/basic_percpu_ops_test.c index eb3f6db36d36..b953a52ff706 100644 --- a/tools/testing/selftests/rseq/basic_percpu_ops_test.c +++ b/tools/testing/selftests/rseq/basic_percpu_ops_test.c @@ -9,10 +9,9 @@ #include #include +#include "../kselftest.h" #include "rseq.h" -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - struct percpu_lock_entry { intptr_t v; } __attribute__((aligned(128))); diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c index 7159eb777fd3..fb440dfca158 100644 --- a/tools/testing/selftests/rseq/rseq.c +++ b/tools/testing/selftests/rseq/rseq.c @@ -27,10 +27,9 @@ #include #include +#include "../kselftest.h" #include "rseq.h" -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - __thread volatile struct rseq __rseq_abi = { .cpu_id = RSEQ_CPU_ID_UNINITIALIZED, }; From patchwork Fri Dec 10 17:33:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80220C4167B for ; Fri, 10 Dec 2021 17:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241476AbhLJRhR (ORCPT ); Fri, 10 Dec 2021 12:37:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244460AbhLJRhP (ORCPT ); Fri, 10 Dec 2021 12:37:15 -0500 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26F91C061D7E for ; Fri, 10 Dec 2021 09:33:35 -0800 (PST) Received: by mail-ot1-x32f.google.com with SMTP id a23-20020a9d4717000000b0056c15d6d0caso10280660otf.12 for ; Fri, 10 Dec 2021 09:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ol2LYejDODLNDCE9czeVtY6ZXvOj8cq9Dfk6NPWHsZY=; b=HBUNCaPvhfUaNQMquE8OUfIRrgmyX82ibPWw02Ng8pu7UyIZi6ZN6ze3wHpalVRLq8 CruwY2I6pMfj2zKyYebS6zyfpAu0zAI0d0VcLZdnKAbaQdFIPrJT+/hLE+aMawAK6euu TsIJst1MmQSizYM3Y4pSmGaUHMkpUbyfEJ0k0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ol2LYejDODLNDCE9czeVtY6ZXvOj8cq9Dfk6NPWHsZY=; b=GGvEDOeHtouxombCZrpRSSDg9gySMoN/EfXZcbB+RbkwUPK7nqlOS5BU3WayoksaNt yh6HbjCQX0kviYp4iGIQ/BcZzXEBIaI1jSqtN5X7DUyFDpN5PzC3mq80ijpPcD/kfMxR bMKvRP92aAZkejE9gHlMY15U36kBRl0UmOCghDITKrJJ96b83Ol1roCqySLQIbxP0atm Q0bNMk6IMwdKFizftxgM6Mr0WAUpk1J7izJCz75qpJdyxuFegB4DIv1oRxbqVKBuI5wy N/c9X+BSrqunkthZrFjAFXS73vfv05qTmVnvKGILGqg+VR6x5p52OmA+2fJkOxqYpvi4 SssQ== X-Gm-Message-State: AOAM532A3OVG+tht27uz5LYoXu1xY3Cu4cGHyOAdwhOnshtQvqgC5Ngt tMHFBns5tRz9OPhUcoiQodVwEw== X-Google-Smtp-Source: ABdhPJwC08jHpPh4Q3noN8ttIxOYmu22m0CTuK9V/wHlRnKrp4RkdnmVkknN/jUdmXkq6G6Ycz5roA== X-Received: by 2002:a05:6830:3094:: with SMTP id f20mr12233166ots.201.1639157614456; Fri, 10 Dec 2021 09:33:34 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:34 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/12] selftests/seccomp: remove ARRAY_SIZE define from seccomp_benchmark Date: Fri, 10 Dec 2021 10:33:19 -0700 Message-Id: <80fa7078e0645649b6e31be4844a3cffbe67a79b.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from seccomp_benchmark and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan Reviewed-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/seccomp_benchmark.c b/tools/testing/selftests/seccomp/seccomp_benchmark.c index 6e5102a7d7c9..5b5c9d558dee 100644 --- a/tools/testing/selftests/seccomp/seccomp_benchmark.c +++ b/tools/testing/selftests/seccomp/seccomp_benchmark.c @@ -18,7 +18,7 @@ #include #include -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) +#include "../kselftest.h" unsigned long long timing(clockid_t clk_id, unsigned long long samples) { From patchwork Fri Dec 10 17:33:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EA3AC433FE for ; Fri, 10 Dec 2021 17:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244518AbhLJRhT (ORCPT ); Fri, 10 Dec 2021 12:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244521AbhLJRhQ (ORCPT ); Fri, 10 Dec 2021 12:37:16 -0500 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47366C0698C6 for ; Fri, 10 Dec 2021 09:33:36 -0800 (PST) Received: by mail-ot1-x32c.google.com with SMTP id x43-20020a056830246b00b00570d09d34ebso10345310otr.2 for ; Fri, 10 Dec 2021 09:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l/J3xxEJxkEvAAiRy+g/i0IsA4cENLPTzNbNRnvQozU=; b=MO5T+UaVz8ug6bW9OaRnZMX373bpG+BInMrxZgZYu0IMhZklmmEfDKCyN/K2MoiODa G6hO3uQZa9blhM3SlfDIt7aLnyMgJDl58ZaCKTgRJS1BUllpVaSen47Y590oxNA+YWox 87Qo100HIDOoVJD0mJaPMQpUlA9+yPM0r9/9k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l/J3xxEJxkEvAAiRy+g/i0IsA4cENLPTzNbNRnvQozU=; b=1/LLsYvZG1F11GgzVoqNup0F7DmFo7wrfqWv443OSkFF4leGd1tfBJEQ+NiNC2mtvm jGOUqDYzBeJh4dXAD63PoL6vJ5wbaLONLE5jDsotdkhi+0Blg+if/nXu96070KMeCHvD pPuYVuDcmMhlHl8hEIxznkMQufDOmB0Jrn5RtycAIWow+ale4HVE9kC/YptHptPle3zo E+lmRoImUQjJiWOatC5QQV3Sk2ekX4bUTri87gE2pTtEP6PtDd8VAGEqIdjRJ0vkcdzy CWhRKR7kJluatU+3lnaVfVv92BSFWKdwenOqFGdxd6EvSWsqy0n121m5H65Tyi5xgASM L38w== X-Gm-Message-State: AOAM533TnrrpvlPH2Y6UCpEjjbiAOQAqSBagqf4rAVh4lv6KR+k1W3lb QjQpTqaBJRYv5oaoUHWcwoTErg== X-Google-Smtp-Source: ABdhPJyBok/xLU4m7kmNcpabZivXV4eEhLTbuaMZiVGExFqxo43MXq9in4SCZUd7RRqOP++fZsAALA== X-Received: by 2002:a9d:7993:: with SMTP id h19mr12393753otm.245.1639157615401; Fri, 10 Dec 2021 09:33:35 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:35 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 10/12] selftests/sparc64: remove ARRAY_SIZE define from adi-test Date: Fri, 10 Dec 2021 10:33:20 -0700 Message-Id: <1d59b5b24a98ffbc83de257c1a9cbe1fd9f01c63.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definition from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from adi-test and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/sparc64/drivers/adi-test.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/testing/selftests/sparc64/drivers/adi-test.c b/tools/testing/selftests/sparc64/drivers/adi-test.c index 95d93c6a88a5..84e5d9fd20b0 100644 --- a/tools/testing/selftests/sparc64/drivers/adi-test.c +++ b/tools/testing/selftests/sparc64/drivers/adi-test.c @@ -24,10 +24,6 @@ #define DEBUG_LEVEL_4_BIT (0x0008) #define DEBUG_TIMING_BIT (0x1000) -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#endif - /* bit mask of enabled bits to print */ #define DEBUG 0x0001 From patchwork Fri Dec 10 17:33:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 959E0C433EF for ; Fri, 10 Dec 2021 17:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244507AbhLJRhS (ORCPT ); Fri, 10 Dec 2021 12:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244518AbhLJRhQ (ORCPT ); Fri, 10 Dec 2021 12:37:16 -0500 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47D15C0698CB for ; Fri, 10 Dec 2021 09:33:37 -0800 (PST) Received: by mail-ot1-x32a.google.com with SMTP id w6-20020a9d77c6000000b0055e804fa524so10335322otl.3 for ; Fri, 10 Dec 2021 09:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DiZeUVUX8yxJeM10Cpt7v1VvqmpI5eFmoRBxYdddIiM=; b=K0OpNOeDoVajb3W4xt0KX7FV9FbcaAXSxNvrA6087bIQw7tap5Xv3ErI4wfxiVZEYz M6AfFqilfX8ijAknnwuE2KW46iOXBC7rxJrpuL1JwcedYnpdXUvl2dp2O008xrVpHkp/ 0+YC6YtffxgVuZdSYs9NfFLK09hxHT0eSo2gM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DiZeUVUX8yxJeM10Cpt7v1VvqmpI5eFmoRBxYdddIiM=; b=ettHbMU3UDEqi0Auq68cUXHydLhhsiCm0yD7fzF6NBD98qw/WAnXuLA6LOm4X0oFrl iVZKXhMUwuSjpewwd3zD9febSeJ6jSmPPBOdZ1v8ZhDEzL4p6muBpp9Gr//DZIk+2VFj /yjLEw0a1tBd5triVudOvxVKHKPDlS1NNAZckLpf7rSmtpwTXs87rNqFN6uUW1jFu02n MZpNpPVHjs+ZPXJJ0FIk/khrwOShHFWhH2KMd5CTSm8HhkS+hu5g7axXYnolc716BmFB UOvs0F+Wk43vTVAHNrfftL7wcyAUNtaqShXunbax5Xo22ghvQeVxmsZO6djg72ITZhZt eR9A== X-Gm-Message-State: AOAM5309gTIw47yFMt8cniM2W1D+elcrX+vynlB0HS4skQkgSmobH4WS N3Vl3fAGoeVNaAjCMDqtrC9dIQ== X-Google-Smtp-Source: ABdhPJwjEnwr1b7d/xDdJEMULYxeBIxDwb3X/wQaHnBiudTS3BTD6SqME8GwsDGoPjchyNdPyOCytA== X-Received: by 2002:a05:6830:1e4a:: with SMTP id e10mr12001687otj.58.1639157616590; Fri, 10 Dec 2021 09:33:36 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:36 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 11/12] selftests/timens: remove ARRAY_SIZE define from individual tests Date: Fri, 10 Dec 2021 10:33:21 -0700 Message-Id: <5837749541102ed658cfae6ab4b68be9f7f96688.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from timens tests and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/timens/procfs.c | 2 -- tools/testing/selftests/timens/timens.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/tools/testing/selftests/timens/procfs.c b/tools/testing/selftests/timens/procfs.c index f2519154208a..1833ca97eb24 100644 --- a/tools/testing/selftests/timens/procfs.c +++ b/tools/testing/selftests/timens/procfs.c @@ -24,8 +24,6 @@ #define DAY_IN_SEC (60*60*24) #define TEN_DAYS_IN_SEC (10*DAY_IN_SEC) -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - static int child_ns, parent_ns; static int switch_ns(int fd) diff --git a/tools/testing/selftests/timens/timens.c b/tools/testing/selftests/timens/timens.c index 52b6a1185f52..387220791a05 100644 --- a/tools/testing/selftests/timens/timens.c +++ b/tools/testing/selftests/timens/timens.c @@ -22,8 +22,6 @@ #define DAY_IN_SEC (60*60*24) #define TEN_DAYS_IN_SEC (10*DAY_IN_SEC) -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - struct test_clock { clockid_t id; char *name; From patchwork Fri Dec 10 17:33:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C313C4332F for ; Fri, 10 Dec 2021 17:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244490AbhLJRhX (ORCPT ); Fri, 10 Dec 2021 12:37:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244520AbhLJRhQ (ORCPT ); Fri, 10 Dec 2021 12:37:16 -0500 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 574B2C061746 for ; Fri, 10 Dec 2021 09:33:38 -0800 (PST) Received: by mail-ot1-x32d.google.com with SMTP id n104-20020a9d2071000000b005799790cf0bso10335142ota.5 for ; Fri, 10 Dec 2021 09:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z8DvdE8cQs/ahPWAnUud5n5yToq2pjtImEbhrWCSKj4=; b=A2U4egVLtJIpoFQ30tstUVGzUGtOmsoHZ0xs8fseV5579Sz4E00j5WbNj12yVBrh10 gBjWd+OSjLozqsC67VnD+TKT5lsMslmI9Dan2YNX0NvXY97ryAY1BHSC/uJesx1iBcpC Pd1bwFa6CQTZ3aeMIGkPxRo3I016VxH2gMgzU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z8DvdE8cQs/ahPWAnUud5n5yToq2pjtImEbhrWCSKj4=; b=7wQSxg+LjMES+Q4MfoGjJEHdV1N+otnAlMMMkDW2V2X7aKbGBxHZR9hnhxwnJrWP2R M+Er+IOEpoUo0JYpA1RA5PpaQLZ1ZhRdMDFD1y51/g5qIVyqZdQGVtWkOYtfEVuUBu3j +Xa/luhMutUorKoP41yJ8c/YgSj50qbVYsWSraazctTRdru3foRgOvVZDFp7j+CkTGf4 7pG6GJgGKvGVOsf+MjYylTPYyM00tMHIvspOzfdQqx5ffHXA3WKigfgAltNXR1XBosAJ R80r1zXwStYHMgrk5kq/2DWdlM6R4fJ6pWX6X0H0wwlLV+dIFIMC2q83cD1hYvs7/i1U Kp3g== X-Gm-Message-State: AOAM533Eyv+QDq0koZc+M/wJUkt4BH539GQcihVjRiU8AVm27v2aov3c XyxQhkeZeI1Y4lMGAAVVF5W2sg== X-Google-Smtp-Source: ABdhPJw/EV9rFIsA/Y2l9EL9YhWZjVYVklXozZh2QN5jLKH28l9K6PLS2YIbrdvs6ptrFP99TR5idg== X-Received: by 2002:a05:6830:1216:: with SMTP id r22mr12680706otp.10.1639157617637; Fri, 10 Dec 2021 09:33:37 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:37 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/12] selftests/vm: remove ARRAY_SIZE define from individual tests Date: Fri, 10 Dec 2021 10:33:22 -0700 Message-Id: <18321f68b399cd2c2709131d6d6eb1d0f58e8b4f.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from vm tests and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/mremap_test.c | 1 - tools/testing/selftests/vm/pkey-helpers.h | 3 ++- tools/testing/selftests/vm/va_128TBswitch.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm/mremap_test.c b/tools/testing/selftests/vm/mremap_test.c index 0624d1bd71b5..7c0b0617b9f8 100644 --- a/tools/testing/selftests/vm/mremap_test.c +++ b/tools/testing/selftests/vm/mremap_test.c @@ -20,7 +20,6 @@ #define VALIDATION_DEFAULT_THRESHOLD 4 /* 4MB */ #define VALIDATION_NO_THRESHOLD 0 /* Verify the entire region */ -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) struct config { diff --git a/tools/testing/selftests/vm/pkey-helpers.h b/tools/testing/selftests/vm/pkey-helpers.h index 622a85848f61..92f3be3dd8e5 100644 --- a/tools/testing/selftests/vm/pkey-helpers.h +++ b/tools/testing/selftests/vm/pkey-helpers.h @@ -13,6 +13,8 @@ #include #include +#include "../kselftest.h" + /* Define some kernel-like types */ #define u8 __u8 #define u16 __u16 @@ -175,7 +177,6 @@ static inline void __pkey_write_allow(int pkey, int do_allow_write) dprintf4("pkey_reg now: %016llx\n", read_pkey_reg()); } -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) #define ALIGN_UP(x, align_to) (((x) + ((align_to)-1)) & ~((align_to)-1)) #define ALIGN_DOWN(x, align_to) ((x) & ~((align_to)-1)) #define ALIGN_PTR_UP(p, ptr_align_to) \ diff --git a/tools/testing/selftests/vm/va_128TBswitch.c b/tools/testing/selftests/vm/va_128TBswitch.c index 83acdff26a13..da6ec3b53ea8 100644 --- a/tools/testing/selftests/vm/va_128TBswitch.c +++ b/tools/testing/selftests/vm/va_128TBswitch.c @@ -9,7 +9,7 @@ #include #include -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#include "../kselftest.h" #ifdef __powerpc64__ #define PAGE_SIZE (64 << 10)