From patchwork Fri Nov 1 11:15:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirsad Todorovac X-Patchwork-Id: 13859240 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9360FE6B240 for ; Fri, 1 Nov 2024 11:17:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29ABA6B007B; Fri, 1 Nov 2024 07:17:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2221E6B0085; Fri, 1 Nov 2024 07:17:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C2EA6B0088; Fri, 1 Nov 2024 07:17:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id DBA306B007B for ; Fri, 1 Nov 2024 07:17:31 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1C66C161CA9 for ; Fri, 1 Nov 2024 11:17:29 +0000 (UTC) X-FDA: 82737274830.16.D175C4E Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf01.hostedemail.com (Postfix) with ESMTP id 21D374000F for ; Fri, 1 Nov 2024 11:17:04 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NzKqrBCx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of mtodorovac69@gmail.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=mtodorovac69@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730459684; a=rsa-sha256; cv=none; b=iayOyPgK5IPJ6dW17zRzxhQoYs9sTA35VS0ix2iknMqE/OGwDvruxzCgwmg+BjtJDAikJd QzE0lRImh71ZA6tHgTKap92aDITlCpdY2IprVCqyTjO0z1I/CXXjpFf4aaDZ29HtvA+V/O yV7YNxSgoGisy0Y618ZCZayLprrCOH8= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NzKqrBCx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of mtodorovac69@gmail.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=mtodorovac69@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730459684; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=owNM3/QzlAhNtYzONHthhBgzoBUFnEtJ8clA/gqOqP8=; b=3pgVuEf9yexjdIIZWc3sndO7V4Ostp3hTPBOzKs41HCNisEtpj1CRMkdW05b3FwekloI7r LUNgVRTI3UtnrMg7Qe/Q0VFXuEGCiYmdx1wd0P5KsiKcFxvKlBhC5DBdbNHJF+rP4kc2v0 dHkg9UWR1G5vda6hL7GqIs0urtqFDhA= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a9e44654ae3so206360166b.1 for ; Fri, 01 Nov 2024 04:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730459846; x=1731064646; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=owNM3/QzlAhNtYzONHthhBgzoBUFnEtJ8clA/gqOqP8=; b=NzKqrBCxhglejoV2QjWgGjh5HtCJBrrE+2bhUPTps2RL5hwJCFvOneteYMn9+PH4qR wcwW3EllQzLonXrIw1x7pJ0ub6by18MQ2DbrQflqEAHb+tN4ANfV3W7Im2JStic+ZLeY 2iDUfPOWKKnauaRhxbsi8WCa1Ohmdq/rJ6ks8Ws5nfDcDmQWVQxPiil/jMGfiQS21nSQ 8wHPo3jz+c4DS+R8QUz/OFT+5J/aUcMO2b9rVvEwDXNkrzOp5gQdfblSrHOsFYdOaepn zkOKWnq5vQ2vvWroNhcwKjqDT9DomrzRYVVHKdNQgqTbZNdpLwkPKQa+cOnblryFeSjm pVhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730459846; x=1731064646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=owNM3/QzlAhNtYzONHthhBgzoBUFnEtJ8clA/gqOqP8=; b=JI7DYcANbdt7H72vX+jBeA/VBEnrolqsq4YVkVWtrI7K3poXDNoRf4KUVzU05ZgTho 5xYYzyehdfZPupswMLQ0uSlaiZzqiHmJaXFexr+hycNlVgIzdeAC+7Vi+O9ikNNRaMV9 NW9CAp1UYvUp97wdPl6qUSKaBlnlJ1cmdYhI0pQn1VUBzkwJjHFTNXFpcYJ6EwBevbd/ RzILg16jrBhpBtAXbi342h+Rf4GxFHKYSAG6vIABw3IVqgqpjYqbqrzhQJkRT9Swsh0Y BvlnGAX+5XQpBGrjkbZyVxWus4WsaFp/Pf9ECloh6y1B+WAX29Hkuly+eRPF3ITa/sry 1iQg== X-Forwarded-Encrypted: i=1; AJvYcCVkz2Jdsfl3OwpwHBllG2t0xGvMKv0GNr9ir0rYSbXF5pVm5tC0Byd0poYRj0sKER+Tb7LxqGXdWQ==@kvack.org X-Gm-Message-State: AOJu0YxX5Tubv/a52G1nspqCGmXbtT8Q3IONDDyVZqSo6v8t7tiSrr9K 7Z8dVBtkjCdCHRKFwcQKKJHG6BNO2tZXruHXEM7tLGJ/dQpMOm0k X-Google-Smtp-Source: AGHT+IGcNVKqsisXLQ6ZTw8bj6zkCrJ2Fi6FOroGRITjh3Eiw9Wx7lM7MdorBUvTtiDM49X2w7QDGg== X-Received: by 2002:a17:907:6d12:b0:a99:d782:2e2b with SMTP id a640c23a62f3a-a9e50938952mr539160766b.30.1730459845500; Fri, 01 Nov 2024 04:17:25 -0700 (PDT) Received: from localhost (dh207-40-94.xnet.hr. [88.207.40.94]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e56494068sm169226566b.31.2024.11.01.04.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 04:17:25 -0700 (PDT) From: Mirsad Todorovac To: Andrew Morton , Suren Baghdasaryan , Mirsad Todorovac , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Shuah Khan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Xu Subject: [PATCH v1 2/2] selftests/mm: fix coccinelle WARNING recommending the use of ARRAY_SIZE() Date: Fri, 1 Nov 2024 12:15:25 +0100 Message-ID: <20241101111523.1293193-4-mtodorovac69@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101111523.1293193-2-mtodorovac69@gmail.com> References: <20241101111523.1293193-2-mtodorovac69@gmail.com> MIME-Version: 1.0 X-Stat-Signature: kebnwmaddogwh6fnndd8c4w67dw5w1t8 X-Rspamd-Queue-Id: 21D374000F X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1730459824-8619 X-HE-Meta: U2FsdGVkX1/7fKINTitwAJSb8ITP7A0RTkzdTxPtcfaqu7UuIlwDE7Fbm3hKqRbnJVh/HSX9cUQTiromb0FeZLfs3eePr2j5a66L8lzIc1zGYVSSTrPd2AMnKWV/uU2kRUfAVzUoV8xcZbyTmdgx6OR8Esl97E8Mp1fzP0ZQHAZ/YMzq2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u9wHN5ShZhtQQyfNLaVPNd9uC2S/WSWOH8MvyXXyLuHU0xASLTxzFvaXzGVd8yLdteeriMvZ2Mhh4k9HFi3jJB74twmeugEvJVoUoLThwbkKThvK/Mfh6J3+0M+0cgA9CVHT/mf9QYa06JHe48h2JmdZ4niF76P51hDAj2iUMmEHsPCcNEyXnPE6fMCONkqO3M6ty/bDCQpOf/nN9OjuZPgzuhsVsaZg+BHJX8GSrMIBzFylXOERL7nqBatZVSqHJxW+hsNh/jt4SHDLHQg/Xi7RZdH1fl1ouZSYy5uwb5DFY9XbBVoD4pweOuNdOU8Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Coccinelle gives WARNING recommending the use of ARRAY_SIZE() macro definition to improve the code readability: ./tools/testing/selftests/mm/uffd-unit-tests.c:1484:32-33: WARNING: Use ARRAY_SIZE ./tools/testing/selftests/mm/uffd-unit-tests.c:1485:30-31: WARNING: Use ARRAY_SIZE Fixes: 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test") Cc: Andrew Morton Cc: Shuah Khan Cc: Peter Xu Cc: linux-mm@kvack.org Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Mirsad Todorovac Acked-by: Peter Xu --- v1: initial version. tools/testing/selftests/mm/uffd-unit-tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index a2e71b1636e7..4f6a7440a9aa 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -1481,8 +1481,8 @@ static void usage(const char *prog) int main(int argc, char *argv[]) { - int n_tests = sizeof(uffd_tests) / sizeof(uffd_test_case_t); - int n_mems = sizeof(mem_types) / sizeof(mem_type_t); + int n_tests = ARRAY_SIZE(uffd_tests); + int n_mems = ARRAY_SIZE(mem_types); const char *test_filter = NULL; bool list_only = false; uffd_test_case_t *test;