From patchwork Fri Nov 1 11:15:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mirsad Todorovac X-Patchwork-Id: 13859238 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 5902E16F8E5; Fri, 1 Nov 2024 11:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730459832; cv=none; b=ODcnq+Og6z9It2PMzW/q4HLrIXPrOeZ1YZKs0X5RL7QnP3713LzjSIGV0xKNRSE/X2HvvBfc9UyOkkAoQZ3QBEw45k+w5QId/TL+beKpP87J4zOVZ8kK3Fp8b8k3oKviV2y+Q3ozM8PKRzJHtrw19XJteq3SW785OCR0W6iPPw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730459832; c=relaxed/simple; bh=5QPEu2ZIm8XWpYWiFlykRMa5UkJdeDfUlIHY7p676BE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hLP/VOybxmWesvwdhwKQLQvKmPfXhckpdhs19o2bDUZlJaXYKMi5NA8qNuIlFK4G66KfxiFQvkCp3M/cn8V28TtbjMNX07yFubnOYdzBpcR8uzqaRnzqH/AGIIz6hj5LDiHHfwCHkIHlf5hhPxBjGaAml2Rn3pD+JqqeSKrlHQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=beTa1rhB; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="beTa1rhB" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a9a2cdc6f0cso253256066b.2; Fri, 01 Nov 2024 04:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730459829; x=1731064629; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YtArAmKRSjy4GcchaiNpaMfT3D/wOjJsG1VCp35IVxY=; b=beTa1rhBZjQzEP9GbH+0mNUJe1ZEQ0pIBkZdysctsM9lP8GEQHGBgglsbvpmryyedu mj/hSRaNu6dFc9OkWwITce9Uu2dNf5rHOO2qEWIExeHisW+uMUeeweeQwsxNsFLDZl6o X415y4dT1NobpTXhRAGc/6Mqkr/hRIbxeTsRhWi7mHX96CQgIqsLLsnJmkFXzZKFr87U bS1XcuTXXQXV2NIcFV6d7jaeBFy+G2aGAcq0p+GWfnTPYO/+MXL4bLqghkWzoNfCXW7p 6gm3vUqyscYPUdfk7ane9JSt0tL9j7vcq02U9h3ykPsexNMrWNZgTTbOMcu922ea1uTP v1ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730459829; x=1731064629; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YtArAmKRSjy4GcchaiNpaMfT3D/wOjJsG1VCp35IVxY=; b=N+wZK6LDD5/dBq6W6xRRU64YJRnA7NXE+7YpnZRe5dH5qnL2wTBp/n4pxGxyvwapuF +x2jDeDmXfdS2DrAi7echTBu3TkeEaW04mEdhwZpeJmA+nP2Q/dbwLwQxyIDzfbi7otA UR5Cc2PPEPJywVvU+xvh7e1j35kMqc6+GGrOB/1o7nALsxn04yEpJmG6mwMJb7ASfpQg tw/GXzuJSdWJ5HAgrVGb7Dvi8MxOpofjha1gSskNN7U7+JSFqI7fg38BBZr7j4U0H3Rs smcFGRx/8gEsNIkDof9TSjDHCmQFIoxjnSEN2D7EcYxSAdFCfBefJoG70LwyIeclmHs/ Gw2Q== X-Forwarded-Encrypted: i=1; AJvYcCUUOXouVPUJkfp3VJ9OI6KSjgcHoLqxbBsmazRoyoGlADImuzUwxykvprNMUXz5Lu5567XNUrXfGHNCpZtaolk3@vger.kernel.org, AJvYcCUsqpJHNuKVWjBO+k2dLPnt2Mv53l7iXpR6Uvt7rBEkw39SZbquhMrzJboYyEk/y1YZTMnqIsDe5e09ENE=@vger.kernel.org X-Gm-Message-State: AOJu0YyDgEVjbTwFLXdmSHHboZhlrrUmSwCxqboXbjwzUJgADpGwHoDx cleMt4Pj9p6X7YxJozjyl/IINXBRkpP0tmIv/6klO0HD64GCZwqo X-Google-Smtp-Source: AGHT+IGYOswi8GmANhJOnv4qTAd/hplNOcov2HOYf1vVwLcaSpO9QPvPflM28+q+u9Xe2bf6/pIihA== X-Received: by 2002:a17:907:72d6:b0:a9a:14fc:9868 with SMTP id a640c23a62f3a-a9e5089b6b2mr555416066b.4.1730459828356; Fri, 01 Nov 2024 04:17:08 -0700 (PDT) Received: from localhost (dh207-40-94.xnet.hr. [88.207.40.94]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e565df949sm168711466b.121.2024.11.01.04.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 04:17:08 -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" Subject: [PATCH v1 1/2] selftests/x86/syscall: fix coccinelle WARNING recommending the use of ARRAY_SIZE() Date: Fri, 1 Nov 2024 12:15:23 +0100 Message-ID: <20241101111523.1293193-2-mtodorovac69@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Coccinelle gives WARNING recommending the use of ARRAY_SIZE() macro definition to improve the code readability: ./tools/testing/selftests/x86/syscall_numbering.c:316:35-36: WARNING: Use ARRAY_SIZE Fixes: 15c82d98a0f78 ("selftests/x86/syscall: Update and extend syscall_numbering_64") Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Cc: Shuah Khan Cc: linux-kernel@vger.kernel.org Cc: linux-kselftest@vger.kernel.org Signed-off-by: Mirsad Todorovac Reviewed-by: Muhammad Usama Anjum --- v1: initial version. tools/testing/selftests/x86/syscall_numbering.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/syscall_numbering.c b/tools/testing/selftests/x86/syscall_numbering.c index 991591718bb0..41c42b7b54a6 100644 --- a/tools/testing/selftests/x86/syscall_numbering.c +++ b/tools/testing/selftests/x86/syscall_numbering.c @@ -25,6 +25,7 @@ #include #include +#include "../kselftest.h" /* Common system call numbers */ #define SYS_READ 0 @@ -313,7 +314,7 @@ static void test_syscall_numbering(void) * The MSB is supposed to be ignored, so we loop over a few * to test that out. */ - for (size_t i = 0; i < sizeof(msbs)/sizeof(msbs[0]); i++) { + for (size_t i = 0; i < ARRAY_SIZE(msbs); i++) { int msb = msbs[i]; run("Checking system calls with msb = %d (0x%x)\n", msb, msb); 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: 13859241 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 99D0216F8E5; Fri, 1 Nov 2024 11:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730459849; cv=none; b=N518NtPiuNOk+EM4A+pIMwixRblO1zryNUO4/rwTVRc4GBbJOUgM7yi2+Z3KM/6SzY/IfLg/pFf2Msn7E5ccqaomklSjCRuOIt4ifWk7hM738KW/NqmejaJ5nmR3R9BE4OyTf1QGvH9MESbvcUHbkTzdjNBya6gmT19W4t3mBLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730459849; c=relaxed/simple; bh=cpgpBdelIWA1Fdk8uQxZCUhbQSBIqgEJWw0Kw4d5BAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mo+i38o9D0RxTx6DnTelBQk4/VldM8alpS/AdrjE4eBHUZV6OSYte+c6nAJBEZenDP6jProEnaM9sXxlwoyvR9Fv7a/DS4sRkgD+SxMgzpVzD6t0DG8MU2lHrRsCPdmgxUyY0W1aqvI+380ZL9Onc+D9Fy/ZfdemlR7lRy+fluQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fOvuOXaC; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fOvuOXaC" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5c94c4ad9d8so2532640a12.2; Fri, 01 Nov 2024 04:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730459846; x=1731064646; darn=vger.kernel.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=fOvuOXaCOMEW+tObVazzcLjgnv3BVGr/7AqzgtuYxl5xTNuPubuIntEIBTDyTs2NBW DXeWMNhHrCXcRIZM6yiGNBDmFX5EUaRO+GJksByAqREx29W5LNhoCT7+62CPU9dx44/j un32BfFoEHWBWBKTWCTUkfsYk4dQFwBLpsnj/et+AWRVaZ6FME8KZDXPAE5iN+I6b7Oi lQMiu31qeTF1YBinEGQG7QDjmvAxHDUP7W2rU/doZauadpu6CCbI4ss2Pv2ReV8IHlGB /3A2N4CKrKMDzESRQXrSiwtCPRQCDGV4/OBGpIswAO9Tn776QqqoMyN5ECk3qQRPtPV2 12jQ== 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=EBmQfkZJ0BX/HDg674n+BNS84IjWxMTtUA8GZ1TtaQH9nBfufsiaJU0FRUgtqJoY1P mmS5xHWQbDmeKpHhdav/L6GF14hXmTKahkbxNHVgWzB7W+/0YOkTcCn4eqWTDSAQW+fQ bBHeilEPlUZ6CcfFp3VGlOlxt2NlVw2mGfXeBX/3qPQ+DuTASIuuMNfYRaYsLYBpwhbB qTisp2Rlo+RjrXjSC5oWyupA5fgECrhXq9uD+7FcPf7hFYa0C+wG4ljSzPgCvXQwZdu4 I9tInuKTIFOnNo4RuT4T8U3ahlryIze6tAgGWO/B/LhfZkUHKwd1aXY7Txg27oNjQXHU 3M3g== X-Forwarded-Encrypted: i=1; AJvYcCVBSIXjv4g8aAV+QTAFRomONJx451MOBC6uv2S+oL5rgu80se/vZuAqP9NpAL6JEeBv8mNV+I7xkoNFuaXH3Qd2@vger.kernel.org, AJvYcCX9B8CJRVtTfZtQDTUviWyXr6jgzxDO+yxsPd13rwO0kgVR7aNzgCJya8NP/a343pABUe7JJsdy49hYiqc=@vger.kernel.org X-Gm-Message-State: AOJu0YzwAVhjsEkI3JVcKfOX3Trj7wKsjcbsXFHd2DdgpGix1OsasqdD ERO3JmkLXzM31RL0kJT2h8OlAvaglfa0cKcDwhEeD9vJAT2jBJtI 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> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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;