From patchwork Sun Nov 13 09:58:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 19333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1621908wru; Sun, 13 Nov 2022 02:11:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4h4wQ+Qkv14nT3wJZO89CivW11k0aLxjAFF7Wk/aKQXuSvOV2Gre+olC9kIGKdtWUg3Va6 X-Received: by 2002:a63:ef0e:0:b0:45f:c9d5:d490 with SMTP id u14-20020a63ef0e000000b0045fc9d5d490mr8055460pgh.392.1668334297776; Sun, 13 Nov 2022 02:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668334297; cv=none; d=google.com; s=arc-20160816; b=Nhd9uWWaZ0larqT8OfCbWM7q5SJWrue3WKqUUIhDJPBXD1q07UBn+e/QaX5EsbNRlT /KNMktqzjd14keoRaznT26MfHtfHgfc8KZjqELFl92bkukbRqU5VVYvBVrGps3rdqA1e Asb3ZkmEY9SVZEDKcFgInFBjb9rtSkpfSobTnYqR49Eoian9KbFcwl5Tr1ec58xeCs4F qNJIEQGbWxdJNL1fhZCW8tr7h4J4QVkWDb2/Od0iJN/5gSyb3ocSW/yIOuOPvnRynr0V PGVxRgHJCZvNDrEVLKl5Ki6IJ95vpmiQuGzbTrIz8kzXgc4saxnerP/08zPwl+im32/y OdbQ== 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:to:from:date; bh=gRlV938spXVtoECNctXgHod5EeecJHEXqvR9Py5QSLA=; b=KS4VYIr7jjJiPqJXeh0a37fgjoJYYI0zs88uCWrbvsb53HJWSh/Lj+UTttuYowmDv0 3kRM9QynJ2cv0GdyuSW9gw4ez/nzDLM60hTbiKWnSpPnrWgBeGhfA5n1/LwKBelDpEiz MKM2L9YkKOs5K/8uWrjLrjbVzN2AsY3lMUI2np/JDqJ4KuB4lZkLBvCxbEkDPUTwmvvq mVeaqF4N00S53yhuJeDRbTcFELMQ2njqFPOHSNdDPwDOy+LdHWdGl+mVKa/+UDaa6MiZ VASfL5/mSHWMhXnaiuwh2UuQ9L69Rs4LPYamTjC21UsmabxYy2IhFtv9Lo8kq02zGysT 0UAw== 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 y2-20020a1709027c8200b00188b297f39bsi4527712pll.216.2022.11.13.02.10.58; Sun, 13 Nov 2022 02:11:37 -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 S235185AbiKMKDf (ORCPT + 99 others); Sun, 13 Nov 2022 05:03:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiKMKDd (ORCPT ); Sun, 13 Nov 2022 05:03:33 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2E0735F40; Sun, 13 Nov 2022 02:03:31 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 13 Nov 2022 17:58:36 +0800 (GMT+08:00) X-Originating-IP: [182.148.14.167] Date: Sun, 13 Nov 2022 17:58:36 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH] samples/seccomp: 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: <2b3f2420.130.184706d34e6.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCnu+HMv3BjEh0DAA--.78W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAEB2FEYx0DfwAds4 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?1749375304729965003?= X-GMAIL-MSGID: =?utf-8?q?1749375304729965003?= Fix following coccicheck warning: samples/seccomp/bpf-fancy.c:83:39-40: WARNING: Use ARRAY_SIZE samples/seccomp/bpf-fancy.c:86:44-45: WARNING: Use ARRAY_SIZE Signed-off-by: KaiLong Wang --- samples/seccomp/bpf-fancy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/seccomp/bpf-fancy.c b/samples/seccomp/bpf-fancy.c index 1ccb435025b6..548f038924d6 100644 --- a/samples/seccomp/bpf-fancy.c +++ b/samples/seccomp/bpf-fancy.c @@ -80,10 +80,10 @@ int main(int argc, char **argv) }; struct sock_fprog prog = { .filter = filter, - .len = (unsigned short)(sizeof(filter)/sizeof(filter[0])), + .len = (unsigned short)(ARRAY_SIZE(filter)), }; ssize_t bytes; - bpf_resolve_jumps(&l, filter, sizeof(filter)/sizeof(*filter)); + bpf_resolve_jumps(&l, filter, ARRAY_SIZE(filter)); if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { perror("prctl(NO_NEW_PRIVS)");