[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5670C04E.3080802@huawei.com>
Date: Wed, 16 Dec 2015 09:37:18 +0800
From: "Wangnan (F)" <wangnan0@...wei.com>
To: Jiri Olsa <jolsa@...hat.com>
CC: <acme@...nel.org>, <masami.hiramatsu.pt@...achi.com>,
<jolsa@...nel.org>, <linux-kernel@...r.kernel.org>,
<pi3orama@....com>, <lizefan@...wei.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH v5 02/14] perf tools: Prevent calling machine__delete()
on non-allocated machine
On 2015/12/15 20:36, Jiri Olsa wrote:
> On Mon, Dec 14, 2015 at 10:39:11AM +0000, Wang Nan wrote:
>
> SNIP
>
>> @@ -137,12 +138,15 @@ void machine__exit(struct machine *machine)
>> void machine__delete(struct machine *machine)
>> {
>> machine__exit(machine);
>> - free(machine);
>> + if (machine->allocated)
>> + free(machine);
>> + else
>> + pr_warning("WARNING: delete a non-allocated machine. Skip.\n");
> we used WARN_ONCE several times already in similar cases
>
> jirka
Will switch to:
@@ -136,13 +138,13 @@ void machine__exit(struct machine *machine)
void machine__delete(struct machine *machine)
{
- machine__exit(machine);
- free(machine);
+ WARN_ONCE((machine->allocated ? free(machine), 0 : -1),
+ "WARNING: deleting a non-allocated machine. Skip.\n");
}
Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists