From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756196Ab2B0Xih (ORCPT ); Mon, 27 Feb 2012 18:38:37 -0500 Received: from mail-vw0-f46.google.com ([209.85.212.46]:64077 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754155Ab2B0Xif (ORCPT ); Mon, 27 Feb 2012 18:38:35 -0500 Authentication-Results: mr.google.com; spf=pass (google.com: domain of fweisbec@gmail.com designates 10.52.93.74 as permitted sender) smtp.mail=fweisbec@gmail.com; dkim=pass header.i=fweisbec@gmail.com Date: Tue, 28 Feb 2012 00:38:31 +0100 From: Frederic Weisbecker To: Ingo Molnar Cc: Namhyung Kim , Peter Zijlstra , Namhyung Kim , Paul Mackerras , Arnaldo Carvalho de Melo , LKML Subject: Re: [PATCH] hw breakpoint: Fix possible memory leak Message-ID: <20120227233828.GE30232@somewhere.redhat.com> References: <1330311739-24302-1-git-send-email-namhyung.kim@lge.com> <1330338785.11248.49.camel@twins> <20120227104452.GA6082@elte.hu> <1330340694.11248.64.camel@twins> <20120227115652.GA9943@elte.hu> <1330349551.1782.15.camel@leonhard> <20120227194038.GA11448@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20120227194038.GA11448@elte.hu> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 27, 2012 at 08:40:38PM +0100, Ingo Molnar wrote: > > * Namhyung Kim wrote: > > > 2012-02-27 (월), 12:56 +0100, Ingo Molnar: > > > * Peter Zijlstra wrote: > > > > > > > On Mon, 2012-02-27 at 11:44 +0100, Ingo Molnar wrote: > > > > > I edited that code earlier today - is the form below OK, or can > > > > > you see a simpler method? It's not yet pushed out so can still > > > > > edit it. > > > > > > > > I think something like the below should do, but then I didn't really > > > > think much about it, my thoughts went like: > > > > > > > > ... *shees* that's ugly > > > > ... that error path already does a loop > > > > ... what the problem is!? -- reread changelog > > > > ... err_cpu == cpu is placed wrong! > > > > > > > > > > > > So I replied and marked read.. waiting to either hear if there's a good > > > > reason to do ugly or find a new (tested) patch in my inbox.. :-) > > > > > > > > --- > > > > kernel/events/hw_breakpoint.c | 4 ++-- > > > > 1 files changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c > > > > index b0309f7..3330022 100644 > > > > --- a/kernel/events/hw_breakpoint.c > > > > +++ b/kernel/events/hw_breakpoint.c > > > > @@ -658,10 +658,10 @@ int __init init_hw_breakpoint(void) > > > > > > > > err_alloc: > > > > for_each_possible_cpu(err_cpu) { > > > > - if (err_cpu == cpu) > > > > - break; > > > > for (i = 0; i < TYPE_MAX; i++) > > > > kfree(per_cpu(nr_task_bp_pinned[i], cpu)); > > > > + if (err_cpu == cpu) > > > > + break; > > > > } > > > > > > Looks a lot nicer - I'll wait for an updated patch. > > > > > > Thanks, > > > > > > Ingo > > > > Ingo, do you want me to resend? If so, I really don't know how > > to give the credit to Peter in this case. > > Just mention it in the changelog that this solution was his > idea. It was you who did most of the work: found the bug, wrote > the patch, wrote the changelog and tested the final patch ;-) And please add my Acked-by: Frederic Weisbecker :)