From patchwork Mon Aug 26 15:12:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Xiaojia X-Patchwork-Id: 13778011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C1DBC5321E for ; Mon, 26 Aug 2024 15:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=8SfmgfakqwaHKkXe93aDY5Z7Mx0blY5ogvEsyhz4MfU=; b=Ly35nn85SNq+VoxP/5ac0pCVyq j4rLku1SQu8A/tb8JQq01vGgY5e+vfxD/G7BkMRu5bbq8v01dzsa+lRiH1NnY6C4YJ7fw6jgt+lI4 3WdOgePXh2piK5mQu3z5zz27VSOoVmEUOfCMUpuGlZQ+wnYH8h/CeVkbQPmQ90UhCWFhZHy/4Wss6 a71dHzj3iRbkn+MvitIUzqAcCYd2GUXkaemaCuQDt2MUrZDfU2LRJpH77xIYfB1ECP1cTOr4M/UB8 d7Xt0nOwwpLp77F+tK8fPXeUMCE2kP23RDTTnab1VYyA7cG2cBajcvId1gQIaGoR/HP+DImGGrjbl dwScTUHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sibI4-00000007kgO-2rNU; Mon, 26 Aug 2024 15:05:56 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sibHH-00000007kbj-0ink for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 15:05:09 +0000 Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wsv5W2HK6z1HHMF; Mon, 26 Aug 2024 23:01:35 +0800 (CST) Received: from dggpemm500021.china.huawei.com (unknown [7.185.36.109]) by mail.maildlp.com (Postfix) with ESMTPS id 14AB61402E1; Mon, 26 Aug 2024 23:04:53 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 26 Aug 2024 23:04:52 +0800 From: Huang Xiaojia To: , , , , , , CC: , Subject: [PATCH -next] arm64: Constify struct kobj_type Date: Mon, 26 Aug 2024 23:12:50 +0800 Message-ID: <20240826151250.3500302-1-huangxiaojia2@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500021.china.huawei.com (7.185.36.109) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_080507_509858_9F02F061 X-CRM114-Status: GOOD ( 11.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 'struct kobj_type' is not modified. It is only used in kobject_init() which takes a 'const struct kobj_type *ktype' parameter. Constifying this structure moves some data to a read-only section, so increase over all security. On a x86_64, compiled with arm defconfig: Before: ====== text data bss dec hex filename 5602 548 352 6502 1966 arch/arm64/kernel/cpuinfo.o After: ====== text data bss dec hex filename 5650 500 352 6502 1966 arch/arm64/kernel/cpuinfo.o Signed-off-by: Huang Xiaojia --- arch/arm64/kernel/cpuinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 09eeaa24d456..369dd72a8b22 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -280,7 +280,7 @@ const struct seq_operations cpuinfo_op = { }; -static struct kobj_type cpuregs_kobj_type = { +static const struct kobj_type cpuregs_kobj_type = { .sysfs_ops = &kobj_sysfs_ops, };