From patchwork Sun Nov 13 09:41:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 19315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1618572wru; Sun, 13 Nov 2022 02:00:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6b4uElbPjDyDLRwPWLHzeZ7VuxkK0Z9gO99zlnV0yCm8bE2gtggcR79WIw893sEV9GAhTj X-Received: by 2002:a65:49c6:0:b0:46f:ed3a:ac42 with SMTP id t6-20020a6549c6000000b0046fed3aac42mr8144626pgs.617.1668333633210; Sun, 13 Nov 2022 02:00:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668333633; cv=none; d=google.com; s=arc-20160816; b=FR1qesNpq0pChzGw7L6LttdSffO1li9olr1QFLp595pJkXu4obo9KkURQ9cI2XUQTp 8Y7DA9NGlmSH2aMMSiES7FVuVr9hJw5Ziwri97ci17BoZGwVdZa1D4qk1UiMbSV6gXz3 iCIjp2EXoVKR4tTTZDBdFcH0tD6RRgausvu6/wIHZBYeW0O/8/mv4R5bX5yurH4P/mFt PX+THN8Yk2kHDUufkjKQnLlr29d/FUw+rliE+a+eYLkYOzxeoffkj2D3TCovH4sxgLc5 4PuiHbVgXUNdad/W67G1KaeYTh4UEydIPpDBcGOJ12z2QrAAwzeyj3R0P3hPHBk4sMGl +aQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:cc:to:from:date; bh=NeqM9J2FN5nzAF15i9urvdl4b/OYmN8bUVyjq9I/mEQ=; b=OgVI5uZRCE5remeVC+ZdvpSEyDQaLm5Q3/gTFj1I8deH3NcGMQMafuVu7QdkuQvc2P UBib9fNQQy5orcALpqZg18Fc8iSCe4xnemN5yngSm0/85Ife1XGZgRdwmIstoYeKQoFb h8xIn1i00xtQIlfpaLJIZS6ehGAJZiLSMiQlxC5jjA7515DLBo6gOT0+0v+pVxm+U1B7 eSg2wT7V5kYQLFKfnykdkMmkTZZG064PyeqrJt0xIzNg6CkNM/rXePfy5WlBMB6DwRJ6 MdxHF2e1WM0vD2Dk5xewexp/03I575og/YpaOvCGATf8GhzDQT527LWs/4DuJ7a0m5m1 EP5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a63b44d000000b004707d555c19si7331407pgu.105.2022.11.13.02.00.15; Sun, 13 Nov 2022 02:00:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235267AbiKMJqP (ORCPT + 99 others); Sun, 13 Nov 2022 04:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiKMJqO (ORCPT ); Sun, 13 Nov 2022 04:46:14 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A802218C; Sun, 13 Nov 2022 01:46:13 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 13 Nov 2022 17:41:10 +0800 (GMT+08:00) X-Originating-IP: [182.148.14.167] Date: Sun, 13 Nov 2022 17:41:10 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kselftest/arm64: fix array_size.cocci warning X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <777ce8ba.12e.184705d4211.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCXq+G2u3BjgRsDAA--.82W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAEB2FEYx0DfwAWsz X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_NONE, T_SPF_HELO_PERMERROR,T_SPF_PERMERROR,XPRIO autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749374608074652382?= X-GMAIL-MSGID: =?utf-8?q?1749374608074652382?= Fix following coccicheck warning: tools/testing/selftests/arm64/mte/check_mmap_options.c:64:24-25: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:66:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:135:25-26: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:96:25-26: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:190:24-25: WARNING: Use ARRAY_SIZE Signed-off-by: KaiLong Wang --- tools/testing/selftests/arm64/mte/check_mmap_options.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_mmap_options.c b/tools/testing/selftests/arm64/mte/check_mmap_options.c index a04b12c21ac9..17694caaff53 100644 --- a/tools/testing/selftests/arm64/mte/check_mmap_options.c +++ b/tools/testing/selftests/arm64/mte/check_mmap_options.c @@ -61,9 +61,8 @@ static int check_anonymous_memory_mapping(int mem_type, int mode, int mapping, i { char *ptr, *map_ptr; int run, result, map_size; - int item = sizeof(sizes)/sizeof(int); + int item = ARRAY_SIZE(sizes); - item = sizeof(sizes)/sizeof(int); mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); for (run = 0; run < item; run++) { map_size = sizes[run] + OVERFLOW + UNDERFLOW; @@ -93,7 +92,7 @@ static int check_file_memory_mapping(int mem_type, int mode, int mapping, int ta { char *ptr, *map_ptr; int run, fd, map_size; - int total = sizeof(sizes)/sizeof(int); + int total = ARRAY_SIZE(sizes); int result = KSFT_PASS; mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); @@ -132,7 +131,7 @@ static int check_clear_prot_mte_flag(int mem_type, int mode, int mapping) { char *ptr, *map_ptr; int run, prot_flag, result, fd, map_size; - int total = sizeof(sizes)/sizeof(int); + int total = ARRAY_SIZE(sizes); prot_flag = PROT_READ | PROT_WRITE; mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); @@ -187,7 +186,7 @@ static int check_clear_prot_mte_flag(int mem_type, int mode, int mapping) int main(int argc, char *argv[]) { int err; - int item = sizeof(sizes)/sizeof(int); + int item = ARRAY_SIZE(sizes); err = mte_default_setup(); if (err)