From nobody Wed Apr 1 09:43:45 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 901E615539A for ; Wed, 1 Apr 2026 00:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775003316; cv=none; b=Z97mpUUGt3y23dUQPUOxluQ25s1zxWshTgbtEJEGoSZvxF4spWqD0enuMyvyGY5EN2lR922iBbT0iDIhrG4dZtOZfArw47TQeaLBNH8ytGJSiIae63pXQ1VFKLYWk9bzSDnZ9k8H77UbL1mTOsM21lHz+2PldOgwY6BcwWETdvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775003316; c=relaxed/simple; bh=PpofUhHFeqNmF2EPmF0nTEHj8cWFrIuv18vLhSjs8c4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XpzQjwLBHTZee+7iknpvRyhOqUPfPlnu5GRfVjAVRb9AhvPqk3kk52ZSfLg0cLDkK59KiHmyn/mb49s4nNL6rJK46e3WERlAq53KpuJsLfvaDZCYY/hoyGHLqMWfZSOmafIhsewSoo3yBzx+mvbpv9+VfjJrCaOaZ76GNrKXXiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com; spf=pass smtp.mailfrom=amutable.com; dkim=pass (2048-bit key) header.d=amutable-com.20230601.gappssmtp.com header.i=@amutable-com.20230601.gappssmtp.com header.b=Ya0bOa0k; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amutable.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amutable-com.20230601.gappssmtp.com header.i=@amutable-com.20230601.gappssmtp.com header.b="Ya0bOa0k" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2b24fcc2b5dso20294455ad.1 for ; Tue, 31 Mar 2026 17:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amutable-com.20230601.gappssmtp.com; s=20230601; t=1775003315; x=1775608115; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8xdtigM1MnP5nQv3PSNQ++1o7F4yals5CCvEBR8RONk=; b=Ya0bOa0kuuzoQ5vOCszGNOybkZ2dOnuJrXOpyFC1Y3JELAN+t2b0zwM0SwqP0Mmxvi XWRpXz0+7RL+Suu/LMaQFg2eZ+/OH5tXzLPkod/qpN0+Esqy3sEwJlzCOaq2Tjhc86Y4 0l7lPxHO0FZHa+xklttApkP1icTw0JHf3BZrUOLcYOJ2FxzJ/jgnVsN/SytdtIDWgs+B 1L1hJL6XX4LIXdTAk+lYaug4Lu7O7GTyl3WP2qkwzwV7gZ4z3b54RbcCWxxSWYoqOg21 3OYgCt1KZSwGdlt0HktiBRRxo9RE7d18iDm6ZUj/1RznVhGYC9N0U4glSOJx8hX0no00 +9Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775003315; x=1775608115; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8xdtigM1MnP5nQv3PSNQ++1o7F4yals5CCvEBR8RONk=; b=cYNpTvhJ0oxIRo3KMnJBo5Jf07yekhkiUEJn9apTW+SsbZHfcp4vazY3K3CEe34NUh 9ibNaqXitazICM79oik6s6iDgn2oQhM55DjekBKVQfaC/73jpd/1PHhAk97DhOHEazeD jV0vPdAmAKIEXK98Tav+ZscQrn/RsySGeoeg5WhCnDmShPQ1VX2xrNyM96nYmV5Ou5IG xvHms865I1+vzXf7A6Brv4zrAukPPUXei3EeCFd/MlfeFCT5LqyDr3m7sZctJaRX3HVK +GGRhZbH9A3l72MCC53qLjsC0iPfUYyMUN3MpNhkFDQPlNjcLDxMAzUuwX6Vtrr7t9nh 7nCw== X-Forwarded-Encrypted: i=1; AJvYcCUq0Y/Z0JGOpTPeeregGN3zy9SxT+EdGGd3yCl6743KsmbQ4qAkiARjO6aK1HPj8au4NS78UipHWvn70Pg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz48eGqj1Y3rep3R6QyPe4wcFa97msLNcY97JMrWKRWnATA33Lq pWe8Flx8BXD1dMxPJpPzpnPUqTrsPzdNL9LdGdc8s9XjVRj/ckGGcZn5dj19mU+R6VJP X-Gm-Gg: ATEYQzxUOhBuqQoOZU344Th16kNpXB3N7sur8Ko9leuSbpDZqy8wAF/r8MNPNfY/wMH 0PUTuhHFqaeIYopN9NFoaOK9r7Yl8gMLPco7eByDMcwr2d7rQEZMySsksLHqtVVTJWK3gPWbbIm A8P51iFPb/dJidpk+mBM1Mr6p2ng07S7Z/aU4nWrEa+XWbwvOOi2fJn3zfdsDHPqHH5r1fY/ssd i3WHMAhezIWm6m5wdcsUJjWLPnnmOc60W/0ln1bvT8t/RSniDAMEijJOKkDEPBv8ZGiSZI5Ekc/ yWLD7jhj0DQcLQyu2PMivx5uK0Tw7IikHdqGvSrxGmOJ7m2Ltw9URDmr0j1lIU11lBlOUBomzqB OYOiy6da6bAbCFbSe5INzUNxvLjkZv8CSs+Z5PQFnMldH0BciJUFDB8lh1tIIMlIv6FMxGgtc/E VolrEYrhFhQ22JR1DT0aF5HQ8RCc6UP9rNIYH8oAFROTpCOQ9rcfsD8FtRg9ghYMIe+Q2uJlYmB j1aUYEnvxaahutiCFtlWfxOxA== X-Received: by 2002:a17:902:e551:b0:2b2:5840:8089 with SMTP id d9443c01a7336-2b269c42c9emr11858965ad.27.1775003314973; Tue, 31 Mar 2026 17:28:34 -0700 (PDT) Received: from thesius.dot.cyphar.com (2403-5809-a2fc-2-a90-9fd7-aedd-d405.ip6.aussiebb.net. [2403:5809:a2fc:2:a90:9fd7:aedd:d405]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b24264264fsm157057825ad.2.2026.03.31.17.28.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2026 17:28:34 -0700 (PDT) From: Aleksa Sarai Date: Wed, 01 Apr 2026 11:28:04 +1100 Subject: [PATCH v2 3/4] selftests: openat2: switch from custom ARRAY_LEN to ARRAY_SIZE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260401-openat2-selftests-kunit-v2-3-ad153a07da0c@amutable.com> References: <20260401-openat2-selftests-kunit-v2-0-ad153a07da0c@amutable.com> In-Reply-To: <20260401-openat2-selftests-kunit-v2-0-ad153a07da0c@amutable.com> To: Shuah Khan Cc: Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Aleksa Sarai , Aleksa Sarai X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3171; i=aleksa@amutable.com; h=from:subject:message-id; bh=PpofUhHFeqNmF2EPmF0nTEHj8cWFrIuv18vLhSjs8c4=; b=owGbwMvMwCWmMf3Xpe0vXfIZT6slMWSeSVsSzr95Z/OdUyW7ph4XnbVwseiK4DfKh6Tlr3Qqb j6Tvu7xyY6JLAxiXAyWYoos2/w8QzfNX3wl+dNKNpg5rEwgQ6RFGhgYGBhYGPhyE/NKjXSM9Ey1 DfUMjXSMdIwYuDgFYKo/XmRk6F4Zy7Vpz24nk37hii7T6d+1ll/gZygKXr10qoh666H/lxh+Moq ZT7nLtF9mgdnkpg+sNam8lx+IPDydmBejcEefMXEaNwA= X-Developer-Key: i=aleksa@amutable.com; a=openpgp; fpr=C9C370B246B09F6DBCFC744C34401015D1D2D386 For whatever reason, the original version of the tests used a custom version of ARRAY_SIZE, but ARRAY_SIZE works just as well. Signed-off-by: Aleksa Sarai --- tools/testing/selftests/filesystems/openat2/helpers.h | 1 - tools/testing/selftests/filesystems/openat2/openat2_test.c | 12 ++++++----= -- tools/testing/selftests/filesystems/openat2/resolve_test.c | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/filesystems/openat2/helpers.h b/tools/= testing/selftests/filesystems/openat2/helpers.h index 975de513af86..f56c0c6e3ad1 100644 --- a/tools/testing/selftests/filesystems/openat2/helpers.h +++ b/tools/testing/selftests/filesystems/openat2/helpers.h @@ -17,7 +17,6 @@ #include #include "kselftest.h" =20 -#define ARRAY_LEN(X) (sizeof (X) / sizeof (*(X))) #define BUILD_BUG_ON(e) ((void)(sizeof(struct { int:(-!!(e)); }))) =20 /* diff --git a/tools/testing/selftests/filesystems/openat2/openat2_test.c b/t= ools/testing/selftests/filesystems/openat2/openat2_test.c index 0e161ef9e9e4..c6c26652ac1b 100644 --- a/tools/testing/selftests/filesystems/openat2/openat2_test.c +++ b/tools/testing/selftests/filesystems/openat2/openat2_test.c @@ -83,14 +83,14 @@ void test_openat2_struct(void) .size =3D sizeof(struct open_how_ext), .err =3D -E2BIG }, }; =20 - BUILD_BUG_ON(ARRAY_LEN(misalignments) !=3D NUM_OPENAT2_STRUCT_VARIATIONS); - BUILD_BUG_ON(ARRAY_LEN(tests) !=3D NUM_OPENAT2_STRUCT_TESTS); + BUILD_BUG_ON(ARRAY_SIZE(misalignments) !=3D NUM_OPENAT2_STRUCT_VARIATIONS= ); + BUILD_BUG_ON(ARRAY_SIZE(tests) !=3D NUM_OPENAT2_STRUCT_TESTS); =20 - for (int i =3D 0; i < ARRAY_LEN(tests); i++) { + for (int i =3D 0; i < ARRAY_SIZE(tests); i++) { struct struct_test *test =3D &tests[i]; struct open_how_ext how_ext =3D test->arg; =20 - for (int j =3D 0; j < ARRAY_LEN(misalignments); j++) { + for (int j =3D 0; j < ARRAY_SIZE(misalignments); j++) { int fd, misalign =3D misalignments[j]; char *fdpath =3D NULL; bool failed; @@ -241,9 +241,9 @@ void test_openat2_flags(void) .how.resolve =3D 0, .err =3D -EINVAL }, }; =20 - BUILD_BUG_ON(ARRAY_LEN(tests) !=3D NUM_OPENAT2_FLAG_TESTS); + BUILD_BUG_ON(ARRAY_SIZE(tests) !=3D NUM_OPENAT2_FLAG_TESTS); =20 - for (int i =3D 0; i < ARRAY_LEN(tests); i++) { + for (int i =3D 0; i < ARRAY_SIZE(tests); i++) { int fd, fdflags =3D -1; char *path, *fdpath =3D NULL; bool failed =3D false; diff --git a/tools/testing/selftests/filesystems/openat2/resolve_test.c b/t= ools/testing/selftests/filesystems/openat2/resolve_test.c index a76ef15ceb90..f7acb4300641 100644 --- a/tools/testing/selftests/filesystems/openat2/resolve_test.c +++ b/tools/testing/selftests/filesystems/openat2/resolve_test.c @@ -436,9 +436,9 @@ void test_openat2_opath_tests(void) .out.err =3D -ELOOP, .pass =3D false }, }; =20 - BUILD_BUG_ON(ARRAY_LEN(tests) !=3D NUM_OPENAT2_OPATH_TESTS); + BUILD_BUG_ON(ARRAY_SIZE(tests) !=3D NUM_OPENAT2_OPATH_TESTS); =20 - for (int i =3D 0; i < ARRAY_LEN(tests); i++) { + for (int i =3D 0; i < ARRAY_SIZE(tests); i++) { int dfd, fd; char *fdpath =3D NULL; bool failed; --=20 2.53.0