tracing/function-profiler: do not free per cpu variable stat
The per cpu variable stat is freeded if we fail to allocate a name on start up. This was due to stat at first being allocated in the initial design. But since then, it has become a static per cpu variable but the free on error was not removed. Also added __init annotation to the function that this is in. [ Impact: prevent possible memory corruption on low mem at boot up ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Родитель
d0b6e04a4c
Коммит
6ab5d668b1
|
@ -768,7 +768,7 @@ static struct tracer_stat function_stats __initdata = {
|
||||||
.stat_show = function_stat_show
|
.stat_show = function_stat_show
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ftrace_profile_debugfs(struct dentry *d_tracer)
|
static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
|
||||||
{
|
{
|
||||||
struct ftrace_profile_stat *stat;
|
struct ftrace_profile_stat *stat;
|
||||||
struct dentry *entry;
|
struct dentry *entry;
|
||||||
|
@ -786,7 +786,6 @@ static void ftrace_profile_debugfs(struct dentry *d_tracer)
|
||||||
* The files created are permanent, if something happens
|
* The files created are permanent, if something happens
|
||||||
* we still do not free memory.
|
* we still do not free memory.
|
||||||
*/
|
*/
|
||||||
kfree(stat);
|
|
||||||
WARN(1,
|
WARN(1,
|
||||||
"Could not allocate stat file for cpu %d\n",
|
"Could not allocate stat file for cpu %d\n",
|
||||||
cpu);
|
cpu);
|
||||||
|
@ -813,7 +812,7 @@ static void ftrace_profile_debugfs(struct dentry *d_tracer)
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CONFIG_FUNCTION_PROFILER */
|
#else /* CONFIG_FUNCTION_PROFILER */
|
||||||
static void ftrace_profile_debugfs(struct dentry *d_tracer)
|
static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_FUNCTION_PROFILER */
|
#endif /* CONFIG_FUNCTION_PROFILER */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче