Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1747495pxm; Thu, 24 Feb 2022 08:38:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqJldIru5i8Q7QFfWti4u2obweke/gmbWIvrkkjqIa+r3TDjoYVSGcgj75HL4phQ+mFJO3 X-Received: by 2002:a63:3dc5:0:b0:370:d638:5826 with SMTP id k188-20020a633dc5000000b00370d6385826mr2913419pga.184.1645720680548; Thu, 24 Feb 2022 08:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645720680; cv=none; d=google.com; s=arc-20160816; b=cqP6pNv/2vCV2/TYcH+7cY68PUhsG3tC9/PsrOOh+pyl/VQdgkcNyMNq8cyPEzqjo9 TIFUWy4FwODLh8QBYS3U1WbDxNMY1/DICXB7MeckomPylC45dCNaSDVN3HhvxRuFl4r0 z34kaW3vAtRYkarQZMXCZivWbJ6pxIQVa5/TcuNO2GXA2tBbsO6PJBQEzucHQbxV7Yq/ hmNhlcHROdtrTyqKo3Ipljx96hDiI/rLzc3Q30/fGSAwtedDtN+Iq5wt80/BGFJUje10 jpShdgWZPFLd9rPqS2eBU9TdhXu1MUbOI66+tmDKGuuWoAEEebx4lHwIBOeNt4YB+xee qCUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=HAuuYz8rMs5MTDbbjVReRWMdYaKrLHBF/3iEl9PI4ao=; b=XXkBhhUbWcK+KJBUQnpkpxAKBUCgSFf7xT0opjpvUcEV/MyskNxSw+RQL2gW9TzcIK kdXJdjetSoFWiBywsZdyT3eBVSXLd3nhE4exHRjP1m/QTjl3TIzXc2UGI1U+mmzo3T6G sBWzpOW2gyIOIMn5aSVH2QbZR2Li+sNC8yVtg/y+5oAi7zm82ed2bOIG+EU+1hqlTpAw mAWDQvNo5s2DFVEGwt9Qt49FB7l5+mzNiUYQGzDPZPEl8fssuRVMz6TuLnfa4CeiEgc/ bMY0PUr7TZFsfWFHe3H1pSJLgMqypL0HOCg4qcECoDTtLrsR0JOHpi5KETGBsWlBtXV7 +5nw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f3si375520pgf.39.2022.02.24.08.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:38:00 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6DBA224FA20; Thu, 24 Feb 2022 08:21:10 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235056AbiBXNdZ (ORCPT + 99 others); Thu, 24 Feb 2022 08:33:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235035AbiBXNdX (ORCPT ); Thu, 24 Feb 2022 08:33:23 -0500 Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B0F3D4B9 for ; Thu, 24 Feb 2022 05:32:51 -0800 (PST) X-QQ-mid: bizesmtp70t1645709553teogwjqm Received: from localhost.localdomain (unknown [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 24 Feb 2022 21:32:30 +0800 (CST) X-QQ-SSF: 01400000002000B0F000B00A0000000 X-QQ-FEAT: ZKIyA7viXp0gWhLqDVbbfYxfkb1rGrN8gS7cOdtlS7mVfvwrf5J+8/rKYvFC7 C/XTCCvT/2Awyd/hxgYSSFTj/R5yQIMkL3l1RyA43TAJIF2tJMBNBuUdhQ599kCIe5m1noz kUjxq2b8nrQ7DkWyQWIlT0qleP7kc1r1cSYDdHen1miSf+NvaRlggGCd+Kcj76Wi4JNQtXE OD/CMdjoN465+2nybrK3U+NRd+oCxrEJ8AOka9iCl2ZQYRGFZRMHM7wA0RMv7GMYk3VEpUj i9W801lL0B/6+bXVsryCWraTiCKfhuVS2lzwWA2vH+BEFDlPRc3JQSZMmpH6IP7isO/tisW RW+2H+fxRLm+R8eBUnHpkjKNUUEekqKxxkEN684X+7BXf5WGJcBmalzqaVaXw== X-QQ-GoodBg: 2 From: Meng Tang To: mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com Cc: guoren@kernel.org, nickhu@andestech.com, green.hu@gmail.com, deanbo422@gmail.com, ebiggers@kernel.org, tytso@mit.edu, wad@chromium.org, john.johansen@canonical.com, jmorris@namei.org, serge@hallyn.com, linux-csky@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Meng Tang Subject: [PATCH v3 2/2] fs/proc: Optimize arrays defined by struct ctl_path Date: Thu, 24 Feb 2022 21:32:17 +0800 Message-Id: <20220224133217.1755-2-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220224133217.1755-1-tangmeng@uniontech.com> References: <20220224133217.1755-1-tangmeng@uniontech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign6 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Previously, arrays defined by struct ctl_path is terminated with an empty one. When we actually only register one ctl_path, we've gone from 8 bytes to 16 bytes. The optimization has been implemented in the previous patch, here to remove unnecessary terminate ctl_path with an empty one. Signed-off-by: Meng Tang --- arch/csky/abiv1/alignment.c | 5 ++--- arch/nds32/mm/alignment.c | 5 ++--- fs/verity/signature.c | 3 +-- kernel/pid_namespace.c | 2 +- kernel/seccomp.c | 3 +-- security/apparmor/lsm.c | 3 +-- security/loadpin/loadpin.c | 3 +-- security/yama/yama_lsm.c | 3 +-- 8 files changed, 10 insertions(+), 17 deletions(-) diff --git a/arch/csky/abiv1/alignment.c b/arch/csky/abiv1/alignment.c index 2df115d0e210..5c2936b29d29 100644 --- a/arch/csky/abiv1/alignment.c +++ b/arch/csky/abiv1/alignment.c @@ -340,9 +340,8 @@ static struct ctl_table sysctl_table[2] = { {} }; -static struct ctl_path sysctl_path[2] = { - {.procname = "csky"}, - {} +static struct ctl_path sysctl_path[1] = { + {.procname = "csky"} }; static int __init csky_alignment_init(void) diff --git a/arch/nds32/mm/alignment.c b/arch/nds32/mm/alignment.c index 1eb7ded6992b..5e79c01b91d6 100644 --- a/arch/nds32/mm/alignment.c +++ b/arch/nds32/mm/alignment.c @@ -560,9 +560,8 @@ static struct ctl_table nds32_sysctl_table[2] = { {} }; -static struct ctl_path nds32_path[2] = { - {.procname = "nds32"}, - {} +static struct ctl_path nds32_path[1] = { + {.procname = "nds32"} }; /* diff --git a/fs/verity/signature.c b/fs/verity/signature.c index 143a530a8008..6cdad230c438 100644 --- a/fs/verity/signature.c +++ b/fs/verity/signature.c @@ -92,8 +92,7 @@ static struct ctl_table_header *fsverity_sysctl_header; static const struct ctl_path fsverity_sysctl_path[] = { { .procname = "fs", }, - { .procname = "verity", }, - { } + { .procname = "verity", } }; static struct ctl_table fsverity_sysctl_table[] = { diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index a46a3723bc66..f4f6db65bf81 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -294,7 +294,7 @@ static struct ctl_table pid_ns_ctl_table[] = { }, { } }; -static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } }; +static struct ctl_path kern_path[] = { { .procname = "kernel", } }; #endif /* CONFIG_CHECKPOINT_RESTORE */ int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) diff --git a/kernel/seccomp.c b/kernel/seccomp.c index db10e73d06e0..03f88d0b79f1 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -2333,8 +2333,7 @@ static int seccomp_actions_logged_handler(struct ctl_table *ro_table, int write, static struct ctl_path seccomp_sysctl_path[] = { { .procname = "kernel", }, - { .procname = "seccomp", }, - { } + { .procname = "seccomp", } }; static struct ctl_table seccomp_sysctl_table[] = { diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 4f0eecb67dde..e35c3b29742d 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -1729,8 +1729,7 @@ static int apparmor_dointvec(struct ctl_table *table, int write, } static struct ctl_path apparmor_sysctl_path[] = { - { .procname = "kernel", }, - { } + { .procname = "kernel", } }; static struct ctl_table apparmor_sysctl_table[] = { diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c index b12f7d986b1e..0471b177d2e1 100644 --- a/security/loadpin/loadpin.c +++ b/security/loadpin/loadpin.c @@ -48,8 +48,7 @@ static DEFINE_SPINLOCK(pinned_root_spinlock); static struct ctl_path loadpin_sysctl_path[] = { { .procname = "kernel", }, - { .procname = "loadpin", }, - { } + { .procname = "loadpin", } }; static struct ctl_table loadpin_sysctl_table[] = { diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index 06e226166aab..b42b61e801b1 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c @@ -449,8 +449,7 @@ static int max_scope = YAMA_SCOPE_NO_ATTACH; static struct ctl_path yama_sysctl_path[] = { { .procname = "kernel", }, - { .procname = "yama", }, - { } + { .procname = "yama", } }; static struct ctl_table yama_sysctl_table[] = { -- 2.20.1