Commit da5de55d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-v5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

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
parents 4544db3f d013496f
...@@ -156,8 +156,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) ...@@ -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. * 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 * 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 * has a "void" prototype, then it is invalid to declare a function
* as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just * as "(void *, void)".
* "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
*/ */
#define __DO_TRACE(tp, proto, args, cond, rcuidle) \ #define __DO_TRACE(tp, proto, args, cond, rcuidle) \
do { \ do { \
...@@ -373,25 +372,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) ...@@ -373,25 +372,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
# define __tracepoint_string # define __tracepoint_string
#endif #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) \ #define DECLARE_TRACE(name, proto, args) \
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
cpu_online(raw_smp_processor_id()), \ cpu_online(raw_smp_processor_id()), \
......
...@@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) ...@@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
list_del_rcu(&direct->next); list_del_rcu(&direct->next);
synchronize_rcu_tasks(); synchronize_rcu_tasks();
kfree(direct); kfree(direct);
kfree(entry);
ftrace_direct_func_count--; ftrace_direct_func_count--;
} }
} }
......
...@@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field) ...@@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field)
kfree(hist_field->name); kfree(hist_field->name);
kfree(hist_field->type); kfree(hist_field->type);
kfree(hist_field->system);
kfree(hist_field->event_name);
kfree(hist_field); kfree(hist_field);
} }
...@@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data, ...@@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data,
goto out; goto out;
} }
var->ref = 1;
var->flags = HIST_FIELD_FL_VAR; var->flags = HIST_FIELD_FL_VAR;
var->var.idx = idx; var->var.idx = idx;
var->var.hist_data = var->hist_data = hist_data; var->var.hist_data = var->hist_data = hist_data;
...@@ -5011,6 +5015,9 @@ static void destroy_field_vars(struct hist_trigger_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++) for (i = 0; i < hist_data->n_field_vars; i++)
destroy_field_var(hist_data->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, static void save_field_var(struct hist_trigger_data *hist_data,
......
...@@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map, ...@@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map,
return idx; 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; unsigned int i;
...@@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a) ...@@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a)
memset(a->pages[i], 0, PAGE_SIZE); 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; unsigned int i;
...@@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a) ...@@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a)
kfree(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) unsigned int entry_size)
{ {
struct tracing_map_array *a; struct tracing_map_array *a;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment