Re: [PATCH 1/4] oprofile: Handle initialisation failure more gracefully

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Robert Richter
Date: Friday, August 27, 2010 - 5:43 am

On 26.08.10 15:09:16, Matt Fleming wrote:

The root cause that makes this check necessary is that
oprofile_arch_exit() is called though oprofile_arch_init() failed. We
should better fix this instead. I have to admit we will then have to
check all architectural implementations.


We should not return from oprofile_arch_init() with allocated
resources if the function fails. To fix duplicate kfrees, we should
free it here and then set counter_config to NULL. It should also be
freed if for_each_possible_cpu() or op_name_from_perf_id() fails.

Also, the pointer should be NULLed after freeing in
oprofile_arch_exit(). There, we also don't need the NULL pointer check
as it is save to call kfree(NULL).

-Robert


-- 
Advanced Micro Devices, Inc.
Operating System Research Center

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/4] oprofile: Handle initialisation failure mo ..., Robert Richter, (Fri Aug 27, 5:43 am)