From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbdF2QOv (ORCPT ); Thu, 29 Jun 2017 12:14:51 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:33535 "EHLO mail-io0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751669AbdF2QOo (ORCPT ); Thu, 29 Jun 2017 12:14:44 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Kees Cook Date: Thu, 29 Jun 2017 09:14:42 -0700 X-Google-Sender-Auth: 2CnJuNJZvYwGFqVh2syJgl_sWgg Message-ID: Subject: Re: [PATCH] kernel: ksysfs: constify attribute_group structures. To: Arvind Yadav , Andrew Morton Cc: Russell King , Dave Young , Hari Bathini , Petr Tesarik , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 29, 2017 at 5:01 AM, Arvind Yadav wrote: > attribute_groups are not supposed to change at runtime. All functions > working with attribute_groups provided by work with const > attribute_group. So mark the non-const structs as const. > > File size before: > text data bss dec hex filename > 1120 544 16 1680 690 kernel/ksysfs.o > > File size After adding 'const': > text data bss dec hex filename > 1160 480 16 1656 678 kernel/ksysfs.o > > Signed-off-by: Arvind Yadav Thanks! Always nice to get more const structures. :) Andrew, can you pick this up? Acked-by: Kees Cook -Kees > --- > kernel/ksysfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c > index 23cd706..df1a9aa 100644 > --- a/kernel/ksysfs.c > +++ b/kernel/ksysfs.c > @@ -234,7 +234,7 @@ static ssize_t notes_read(struct file *filp, struct kobject *kobj, > NULL > }; > > -static struct attribute_group kernel_attr_group = { > +static const struct attribute_group kernel_attr_group = { > .attrs = kernel_attrs, > }; > > -- > 1.9.1 > -- Kees Cook Pixel Security