]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Merge tag 'trace-v5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Apr 2020 19:39:21 +0000 (12:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Apr 2020 19:39:21 +0000 (12:39 -0700)
Pull tracing fixes from Steven Rostedt:
 "A few tracing fixes:

   - Two fixes for memory leaks detected by kmemleak

   - Removal of some dead code

   - A few local functions turned static"

* tag 'trace-v5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Convert local functions in tracing_map.c to static
  tracing: Remove DECLARE_TRACE_NOARGS
  ftrace: Fix memory leak caused by not freeing entry in unregister_ftrace_direct()
  tracing: Fix memory leaks in trace_events_hist.c

include/linux/tracepoint.h
kernel/trace/ftrace.c
kernel/trace/trace_events_hist.c
kernel/trace/tracing_map.c

index 1fb11daa5c5334c6ecbbd5a77a3c0a6c152e3f84..a1fecf31162174036352198afee3260cdbab3670 100644 (file)
@@ -156,8 +156,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  * Note, the proto and args passed in includes "__data" as the first parameter.
  * The reason for this is to handle the "void" prototype. If a tracepoint
  * has a "void" prototype, then it is invalid to declare a function
- * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
- * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
+ * as "(void *, void)".
  */
 #define __DO_TRACE(tp, proto, args, cond, rcuidle)                     \
        do {                                                            \
@@ -373,25 +372,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 # define __tracepoint_string
 #endif
 
-/*
- * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
- * (void). "void" is a special value in a function prototype and can
- * not be combined with other arguments. Since the DECLARE_TRACE()
- * macro adds a data element at the beginning of the prototype,
- * we need a way to differentiate "(void *data, proto)" from
- * "(void *data, void)". The second prototype is invalid.
- *
- * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype
- * and "void *__data" as the callback prototype.
- *
- * DECLARE_TRACE() passes "proto" as the tracepoint protoype and
- * "void *__data, proto" as the callback prototype.
- */
-#define DECLARE_TRACE_NOARGS(name)                                     \
-       __DECLARE_TRACE(name, void, ,                                   \
-                       cpu_online(raw_smp_processor_id()),             \
-                       void *__data, __data)
-
 #define DECLARE_TRACE(name, proto, args)                               \
        __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),              \
                        cpu_online(raw_smp_processor_id()),             \
index 041694a1eb74d88d8b0fb44d26f13d06a7a29d82..bd030b1b9514857cce1e0b38f0f9e2bcce7fa78f 100644 (file)
@@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
                        list_del_rcu(&direct->next);
                        synchronize_rcu_tasks();
                        kfree(direct);
+                       kfree(entry);
                        ftrace_direct_func_count--;
                }
        }
index 5f6834a2bf4119ef4a30879cac479e0cbc0e5bdf..fcab11cc6833b2ccb74a169ee184584de64f5205 100644 (file)
@@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field)
        kfree(hist_field->name);
        kfree(hist_field->type);
 
+       kfree(hist_field->system);
+       kfree(hist_field->event_name);
+
        kfree(hist_field);
 }
 
@@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data,
                goto out;
        }
 
+       var->ref = 1;
        var->flags = HIST_FIELD_FL_VAR;
        var->var.idx = idx;
        var->var.hist_data = var->hist_data = hist_data;
@@ -5011,6 +5015,9 @@ static void destroy_field_vars(struct hist_trigger_data *hist_data)
 
        for (i = 0; i < hist_data->n_field_vars; i++)
                destroy_field_var(hist_data->field_vars[i]);
+
+       for (i = 0; i < hist_data->n_save_vars; i++)
+               destroy_field_var(hist_data->save_vars[i]);
 }
 
 static void save_field_var(struct hist_trigger_data *hist_data,
index 9e31bfc818ff821dae0f82e4f5c1048a149a9f20..74738c9856f164af0f7ed08cbaaf4d9b4041aff0 100644 (file)
@@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map,
        return idx;
 }
 
-void tracing_map_array_clear(struct tracing_map_array *a)
+static void tracing_map_array_clear(struct tracing_map_array *a)
 {
        unsigned int i;
 
@@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a)
                memset(a->pages[i], 0, PAGE_SIZE);
 }
 
-void tracing_map_array_free(struct tracing_map_array *a)
+static void tracing_map_array_free(struct tracing_map_array *a)
 {
        unsigned int i;
 
@@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a)
        kfree(a);
 }
 
-struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
+static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
                                                  unsigned int entry_size)
 {
        struct tracing_map_array *a;