Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5556156rwb; Mon, 14 Nov 2022 06:24:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qnmEU8U4+V/N87QPFLaFzuYkpYUsQHZx4Vx03J0ppl34XaObJ8NUQYdJ/6gEJuC9Xg+6w X-Received: by 2002:a17:906:2b57:b0:7ad:b45c:dbe7 with SMTP id b23-20020a1709062b5700b007adb45cdbe7mr10124424ejg.617.1668435852333; Mon, 14 Nov 2022 06:24:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668435852; cv=none; d=google.com; s=arc-20160816; b=qKDrUPnkbBvDyksntACN91/qYfsVSfX3DMlqYcI4ruVvqf0pzJRcdTq40JzDJDRlRX BmxrwMB8oNDDaA+ZVVaFEExjwjZePCrjkWpgTvrT0ug8mk5pEW5ROH6q93RbgStFlD/E 0A2U+LEyPU78JXU/QuveCGKTt9B7suEzqJ9qo1jtSYrBLzaNMeIiKSvxAi6i8DFlnHyl Zp4oevopxwHSQfwE/pGI9LBLvEYj+J3dQJxpyjJZo8Jj4RhWI0CTMsU95HbkTLzjv+zL rpAjwixwYXzKlGgtmcvu1q87ogm9riUOMhBlQV58oSqtKNuUTkQnPB+0gX/PwXZrK8gV EJ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=iqn8y9FBRzi97Ax0rT0tRNQDNBvV7DzAV3e3JldASiw=; b=lYfEPJm39UdufoL3eNS+fC3RziYAB7tOucwSdyg10p8h9XlK9w5j6mSpKYw7V7FrKK /pZQPPNQciVzWLmuz0yLqUNIv6s/YBaAGQmSj4SRr+Izp23rgKHXOpB3LEl3orFMP8lT 36D49b329oKfYxA8QGCczIL9Rgx/MytEAygmm/HTW7aeqyIM13TQCwSEO1eISXJfDhfs tQJE45gihmujoFbBxEXwZwgpNmYSjy9ZMfbRjHs3KJK+OBXjUt+zuiKbe2yz1inz9txx EyA/GJ/4pknHik4g+qoKyOv2SvzotNlgQXkzNraL8X3lPWn3qFQ/1K2N++2iSZgx5B59 kTnA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc29-20020a1709078a1d00b007a7d37e467csi8757409ejc.763.2022.11.14.06.23.50; Mon, 14 Nov 2022 06:24:12 -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 S235925AbiKNNSC (ORCPT + 87 others); Mon, 14 Nov 2022 08:18:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237997AbiKNNRd (ORCPT ); Mon, 14 Nov 2022 08:17:33 -0500 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E9A52C659 for ; Mon, 14 Nov 2022 05:17:22 -0800 (PST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4N9qbf2gHzz9spk; Mon, 14 Nov 2022 14:17:18 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2O5T-nK_uqQ0; Mon, 14 Nov 2022 14:17:18 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4N9qbf1sh1z9spf; Mon, 14 Nov 2022 14:17:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2F63D8B76C; Mon, 14 Nov 2022 14:17:18 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 1d5Xc0h4vh-T; Mon, 14 Nov 2022 14:17:18 +0100 (CET) Received: from [172.25.230.108] (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0D5C38B763; Mon, 14 Nov 2022 14:17:18 +0100 (CET) Message-ID: <4ed43222-17b0-8355-f836-adabb453e432@csgroup.eu> Date: Mon, 14 Nov 2022 14:17:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] powerpc/xmon: Fix array_size.cocci warning Content-Language: fr-FR To: wangkailong@jari.cn, mpe@ellerman.id.au, npiggin@gmail.com, Julia.Lawall@inria.fr, joel@jms.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <6432107b.12b.1847043884e.Coremail.wangkailong@jari.cn> From: Christophe Leroy In-Reply-To: <6432107b.12b.1847043884e.Coremail.wangkailong@jari.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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 Le 13/11/2022 à 10:13, wangkailong@jari.cn a écrit : > Fix the following coccicheck warning: > > arch/powerpc/xmon/ppc-opc.c:957:67-68: WARNING: Use ARRAY_SIZE > arch/powerpc/xmon/ppc-opc.c:7280:24-25: WARNING: Use ARRAY_SIZE > arch/powerpc/xmon/ppc-opc.c:6972:25-26: WARNING: Use ARRAY_SIZE > arch/powerpc/xmon/ppc-opc.c:7211:21-22: WARNING: Use ARRAY_SIZE > > Signed-off-by: KaiLong Wang This code is copied from Binutils. This change has been rejected several times already. See https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20181004171036.GA1907@embeddedor.com/#2006148 Christophe > --- > arch/powerpc/xmon/ppc-opc.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c > index 0774d711453e..ad64c2709757 100644 > --- a/arch/powerpc/xmon/ppc-opc.c > +++ b/arch/powerpc/xmon/ppc-opc.c > @@ -954,9 +954,7 @@ const struct powerpc_operand powerpc_operands[] = > { 0xff, 11, NULL, NULL, PPC_OPERAND_SIGNOPT }, > }; > > -const unsigned int num_powerpc_operands = (sizeof (powerpc_operands) > - / sizeof (powerpc_operands[0])); > - > +const unsigned int num_powerpc_operands = ARRAY_SIZE(powerpc_operands); > /* The functions used to insert and extract complicated operands. */ > > /* The ARX, ARY, RX and RY operands are alternate encodings of GPRs. */ > @@ -6968,8 +6966,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { > {"fcfidu.", XRC(63,974,1), XRA_MASK, POWER7|PPCA2, PPCVLE, {FRT, FRB}}, > }; > > -const int powerpc_num_opcodes = > - sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]); > +const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes); > > /* The VLE opcode table. > > @@ -7207,8 +7204,7 @@ const struct powerpc_opcode vle_opcodes[] = { > {"se_bl", BD8(58,0,1), BD8_MASK, PPCVLE, 0, {B8}}, > }; > > -const int vle_num_opcodes = > - sizeof (vle_opcodes) / sizeof (vle_opcodes[0]); > +const int vle_num_opcodes = ARRAY_SIZE(vle_opcodes); > > /* The macro table. This is only used by the assembler. */ > > @@ -7276,5 +7272,4 @@ const struct powerpc_macro powerpc_macros[] = { > {"e_clrlslwi",4, PPCVLE, "e_rlwinm %0,%1,%3,(%2)-(%3),31-(%3)"}, > }; > > -const int powerpc_num_macros = > - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); > +const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros);