+ dynamic_debug-dont-duplicate-modname-in-ddebug_add_module.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: dynamic_debug: don't duplicate modname in ddebug_add_module
has been added to the -mm tree.  Its filename is
     dynamic_debug-dont-duplicate-modname-in-ddebug_add_module.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/dynamic_debug-dont-duplicate-modname-in-ddebug_add_module.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/dynamic_debug-dont-duplicate-modname-in-ddebug_add_module.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Subject: dynamic_debug: don't duplicate modname in ddebug_add_module

For built-in modules, we're already reusing the passed-in string via
kstrdup_const().  But for actual modules (i.e.  when we're called from
dynamic_debug_setup in module.c), the passed-in string (which points at
the name[] array inside struct module) is also guaranteed to live at least
as long as the struct ddebug_table, since free_module() calls
ddebug_remove_module().

Link: http://lkml.kernel.org/r/20190212214150.4807-6-linux@xxxxxxxxxxxxxxxxxx
Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Acked-by: Jason Baron <jbaron@xxxxxxxxxx>
Cc: David Sterba <dsterba@xxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Petr Mladek <pmladek@xxxxxxxx>
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@xxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 lib/dynamic_debug.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

--- a/lib/dynamic_debug.c~dynamic_debug-dont-duplicate-modname-in-ddebug_add_module
+++ a/lib/dynamic_debug.c
@@ -847,17 +847,17 @@ int ddebug_add_module(struct _ddebug *ta
 			     const char *name)
 {
 	struct ddebug_table *dt;
-	const char *new_name;
 
 	dt = kzalloc(sizeof(*dt), GFP_KERNEL);
 	if (dt == NULL)
 		return -ENOMEM;
-	new_name = kstrdup_const(name, GFP_KERNEL);
-	if (new_name == NULL) {
-		kfree(dt);
-		return -ENOMEM;
-	}
-	dt->mod_name = new_name;
+	/*
+	 * For built-in modules, name lives in .rodata and is
+	 * immortal. For loaded modules, name points at the name[]
+	 * member of struct module, which lives at least as long as
+	 * this struct ddebug_table.
+	 */
+	dt->mod_name = name;
 	dt->num_ddebugs = n;
 	dt->ddebugs = tab;
 
@@ -913,7 +913,6 @@ int ddebug_dyndbg_module_param_cb(char *
 static void ddebug_table_free(struct ddebug_table *dt)
 {
 	list_del_init(&dt->link);
-	kfree_const(dt->mod_name);
 	kfree(dt);
 }
 
_

Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are

build_bugh-add-wrapper-for-_static_assert.patch
lib-vsprintfc-move-sizeofstruct-printf_spec-next-to-its-definition.patch
linux-fsh-move-member-alignment-check-next-to-definition-of-struct-filename.patch
linux-deviceh-use-dynamic_debug_branch-in-dev_dbg_ratelimited.patch
linux-neth-use-dynamic_debug_branch-in-net_dbg_ratelimited.patch
linux-printkh-use-dynamic_debug_branch-in-pr_debug_ratelimited.patch
dynamic_debug-consolidate-define_dynamic_debug_metadata-definitions.patch
dynamic_debug-dont-duplicate-modname-in-ddebug_add_module.patch
dynamic_debug-use-pointer-comparison-in-ddebug_remove_module.patch
dynamic_debug-remove-unused-export_symbols.patch
dynamic_debug-move-pr_err-from-modulec-to-ddebug_add_module.patch
dynamic_debug-add-static-inline-stub-for-ddebug_add_module.patch
dynamic_debug-refactor-dynamic_pr_debug-and-friends.patch
btrfs-implement-btrfs_debug-in-terms-of-helper-macro.patch
acpi-use-proper-dynamic_debug_branch-macro.patch
acpi-remove-unused-__acpi_handle_debug-macro.patch
acpi-implement-acpi_handle_debug-in-terms-of-_dynamic_func_call.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux