From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754178AbbIJOX6 (ORCPT ); Thu, 10 Sep 2015 10:23:58 -0400 Received: from a23-79-238-179.deploy.static.akamaitechnologies.com ([23.79.238.179]:52102 "EHLO prod-mail-xrelay05.akamai.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752521AbbIJOXz (ORCPT ); Thu, 10 Sep 2015 10:23:55 -0400 Message-ID: <55F1927A.2040408@akamai.com> Date: Thu, 10 Sep 2015 10:23:54 -0400 From: Jason Baron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Rasmus Villemoes , Andrew Morton CC: "linux-kernel@vger.kernel.org" , gregkh@linuxfoundation.org Subject: Re: [PATCH] lib/dynamic_debug.c: use kstrdup_const References: <1441834842-13950-1-git-send-email-linux@rasmusvillemoes.dk> In-Reply-To: <1441834842-13950-1-git-send-email-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks fine to me. Acked-by: Jason Baron Andrew, want to pick this up? Thanks, -Jason On 09/09/2015 05:40 PM, Rasmus Villemoes wrote: > Using kstrdup_const, thus reusing .rodata when possible, saves around > 2 kB of runtime memory on my laptop/.config combination. > > Signed-off-by: Rasmus Villemoes > --- > lib/dynamic_debug.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c > index e491e02eff54..e3952e9c8ec0 100644 > --- a/lib/dynamic_debug.c > +++ b/lib/dynamic_debug.c > @@ -42,7 +42,7 @@ extern struct _ddebug __stop___verbose[]; > > struct ddebug_table { > struct list_head link; > - char *mod_name; > + const char *mod_name; > unsigned int num_ddebugs; > struct _ddebug *ddebugs; > }; > @@ -841,12 +841,12 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, > const char *name) > { > struct ddebug_table *dt; > - char *new_name; > + const char *new_name; > > dt = kzalloc(sizeof(*dt), GFP_KERNEL); > if (dt == NULL) > return -ENOMEM; > - new_name = kstrdup(name, GFP_KERNEL); > + new_name = kstrdup_const(name, GFP_KERNEL); > if (new_name == NULL) { > kfree(dt); > return -ENOMEM; > @@ -907,7 +907,7 @@ int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module) > static void ddebug_table_free(struct ddebug_table *dt) > { > list_del_init(&dt->link); > - kfree(dt->mod_name); > + kfree_const(dt->mod_name); > kfree(dt); > } > >