Skip to content

Commit da5de55

Browse files
committed
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
2 parents 4544db3 + d013496 commit da5de55

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

include/linux/tracepoint.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
156156
* Note, the proto and args passed in includes "__data" as the first parameter.
157157
* The reason for this is to handle the "void" prototype. If a tracepoint
158158
* has a "void" prototype, then it is invalid to declare a function
159-
* as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
160-
* "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
159+
* as "(void *, void)".
161160
*/
162161
#define __DO_TRACE(tp, proto, args, cond, rcuidle) \
163162
do { \
@@ -373,25 +372,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
373372
# define __tracepoint_string
374373
#endif
375374

376-
/*
377-
* The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
378-
* (void). "void" is a special value in a function prototype and can
379-
* not be combined with other arguments. Since the DECLARE_TRACE()
380-
* macro adds a data element at the beginning of the prototype,
381-
* we need a way to differentiate "(void *data, proto)" from
382-
* "(void *data, void)". The second prototype is invalid.
383-
*
384-
* DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype
385-
* and "void *__data" as the callback prototype.
386-
*
387-
* DECLARE_TRACE() passes "proto" as the tracepoint protoype and
388-
* "void *__data, proto" as the callback prototype.
389-
*/
390-
#define DECLARE_TRACE_NOARGS(name) \
391-
__DECLARE_TRACE(name, void, , \
392-
cpu_online(raw_smp_processor_id()), \
393-
void *__data, __data)
394-
395375
#define DECLARE_TRACE(name, proto, args) \
396376
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
397377
cpu_online(raw_smp_processor_id()), \

kernel/trace/ftrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
51655165
list_del_rcu(&direct->next);
51665166
synchronize_rcu_tasks();
51675167
kfree(direct);
5168+
kfree(entry);
51685169
ftrace_direct_func_count--;
51695170
}
51705171
}

kernel/trace/trace_events_hist.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field)
33203320
kfree(hist_field->name);
33213321
kfree(hist_field->type);
33223322

3323+
kfree(hist_field->system);
3324+
kfree(hist_field->event_name);
3325+
33233326
kfree(hist_field);
33243327
}
33253328

@@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data,
43824385
goto out;
43834386
}
43844387

4388+
var->ref = 1;
43854389
var->flags = HIST_FIELD_FL_VAR;
43864390
var->var.idx = idx;
43874391
var->var.hist_data = var->hist_data = hist_data;
@@ -5011,6 +5015,9 @@ static void destroy_field_vars(struct hist_trigger_data *hist_data)
50115015

50125016
for (i = 0; i < hist_data->n_field_vars; i++)
50135017
destroy_field_var(hist_data->field_vars[i]);
5018+
5019+
for (i = 0; i < hist_data->n_save_vars; i++)
5020+
destroy_field_var(hist_data->save_vars[i]);
50145021
}
50155022

50165023
static void save_field_var(struct hist_trigger_data *hist_data,

kernel/trace/tracing_map.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map,
283283
return idx;
284284
}
285285

286-
void tracing_map_array_clear(struct tracing_map_array *a)
286+
static void tracing_map_array_clear(struct tracing_map_array *a)
287287
{
288288
unsigned int i;
289289

@@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a)
294294
memset(a->pages[i], 0, PAGE_SIZE);
295295
}
296296

297-
void tracing_map_array_free(struct tracing_map_array *a)
297+
static void tracing_map_array_free(struct tracing_map_array *a)
298298
{
299299
unsigned int i;
300300

@@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a)
316316
kfree(a);
317317
}
318318

319-
struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
319+
static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
320320
unsigned int entry_size)
321321
{
322322
struct tracing_map_array *a;

0 commit comments

Comments
 (0)