Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2183316ybd; Mon, 24 Jun 2019 02:08:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPNwGInx8NfVVErXwk7Yh4SvFUO+cp/e5IUPZRo2u3mQBtlPgzbh//sTGcD6n2HNBmm3e0 X-Received: by 2002:a63:4553:: with SMTP id u19mr31591845pgk.420.1561367298168; Mon, 24 Jun 2019 02:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561367298; cv=none; d=google.com; s=arc-20160816; b=FNYVhFiLjizuyXGxLem1qkMjSKQDvWWdMT22xvy4hYxhOMRZexvE4UTMF48M90R8Br e8zVeCEPq9zFlMgyIHpPXeEXYbl5CEkJNVjI7Y9iMzTl8C2CgPFKg83doZiPvPjN6bCf 5367QgzbSGYPDo7A+P6+LK8EpsoVENFhV4MP+RYgE56BKPN5gaFtmDyuTsvz2iha+T6I nLGZHJTjQJsggrC5zreH2BZ/Uwu+Fr2+wzMYtC64hZflP8kzI9OXEJqffIqY3C8YhAJh /auRLuCGAqBDLZDAWxW6PJb1qFrOaxcnEqAJBjAPv9e4ypNWogEqbTIB+ha57LUWCat/ I7jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RT4lEk5fN7HFZePgHSc4vHCyrKek0LAJIXSg/6ONn94=; b=UeIV2XDMpXQwMigLMw9FT5GM68oFIQgGpii3SfnqH9huXqfwbO4HomhEsKMuLjF+nr iB0jy4dtK8TzHEF00l/GaakxdpBzHnyuzRmoDitW83WZ2WCyjOqC7ckCPA/V3Qn495jb wXn4HDDvgcGiVUl/7YWt+pSO9ywEJgHzUg5VBr6aXtX7StWoiotzim+xX1SFvKEucED3 gxJuHURx5cm/j+aRtjTvVKJiJTa+McaQAoI1ewAoORyj/A+Mm4d8hiSt5blASB557PC/ fNFzJo5PLbE/E/iC/lGQFL3tdjmMD8DAapqYhtjMWCh4Uv0SXbheko9m0WjlFUUhc7sq rxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=kW6SnZC7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14si9705555pgh.98.2019.06.24.02.08.01; Mon, 24 Jun 2019 02:08:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=kW6SnZC7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728245AbfFXJFI (ORCPT + 99 others); Mon, 24 Jun 2019 05:05:08 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:42387 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfFXJFI (ORCPT ); Mon, 24 Jun 2019 05:05:08 -0400 Received: by mail-io1-f65.google.com with SMTP id u19so1420764ior.9 for ; Mon, 24 Jun 2019 02:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RT4lEk5fN7HFZePgHSc4vHCyrKek0LAJIXSg/6ONn94=; b=kW6SnZC7+SUahHh8QHkx5EZO/GZhKr4MN2xFKG6Z/Co/A/pvQ9gv2RhrPctSMF99KF +cfWXOTaaJm4GiBRUfZ0cy9jj/bbs1jdkzVt/lTnjwNqmBC57ka2rlCnKqyhbfDNVOud e2RIkO2eXyOqr1R6unsFUNSfSuiXVYw8V8RvyIJ0GofaU9F/iB7SpA6VPbuBkCd2q3HL adQl4q5OSRajsSaqC2clbe9eMtqdmrRJUY6I5mvO+Z5Qa/3UGF/XnZV5nj6rbnGWARz+ TGzy31TkZOdhiA+Gfiyhn2id34l4xHli2ieBUUIy1uJTH0t1dointiClqCTGlVSQBQRJ IXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RT4lEk5fN7HFZePgHSc4vHCyrKek0LAJIXSg/6ONn94=; b=bgCr/lEozE0uEFv2AbKpN+ZXtvjdy+b8qbau+goaCXVgyp/3orvxh5cWF7yJq8ImUj 9ZITyn98FvIk9cSUEn2cSchIycLEf8wph7EFr4KqEE/Q2i+SOiM2nvtFKwit6e5KWjQ+ izLijt/xqNyTv8EXqW3TaO3L/6CECrvilcDbqdLVmVsY2l72L6lZk/7h7YvR0k4U+pKQ 6uyiqYM9+6OxCl/ycSjkAtJ9eX7A14KE6uBViZWbXha1xTgl7YTNieKK+DjO5XQ+Yo+w qVcww6MVHXJMTRUOQPOO7pi6IpzQN1eDxGp0VJDTwaEWL/TZswdgAxRb8i9+Hf4KRzO9 e6gg== X-Gm-Message-State: APjAAAWO+OTTDUG9E5HR+mclekvdEk0EZ0U4TOiGohvSRfZg6mvmpU+0 S9hKeD05c7qAvk4bkg/LaD3jNCvLvaZQPhfaVlAxRw== X-Received: by 2002:a5d:9c46:: with SMTP id 6mr8686796iof.6.1561367107600; Mon, 24 Jun 2019 02:05:07 -0700 (PDT) MIME-Version: 1.0 References: <20190617113109.24689-1-colin.king@canonical.com> <20190624090339.GW28859@kadam> In-Reply-To: <20190624090339.GW28859@kadam> From: Bartosz Golaszewski Date: Mon, 24 Jun 2019 11:04:56 +0200 Message-ID: Subject: Re: [PATCH][next] clocksource: davinci-timer: fix memory leak of clockevent on error return To: Dan Carpenter Cc: Bartosz Golaszewski , Colin King , Daniel Lezcano , Thomas Gleixner , kernel-janitors@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pon., 24 cze 2019 o 11:04 Dan Carpenter napisa= =C5=82(a): > > On Mon, Jun 24, 2019 at 10:28:10AM +0200, Bartosz Golaszewski wrote: > > pon., 17 cze 2019 o 13:31 Colin King napisa= =C5=82(a): > > > > > > From: Colin Ian King > > > > > > Currently when the call to request_irq falls there is a memory leak o= f > > > clockevent on the error return path. Fix this by kfree'ing clockevent= . > > > > > > Addresses-Coverity: ("Resource leak") > > > Fixes: fe3b8194f274 ("clocksource: davinci-timer: add support for clo= ckevents") > > > Signed-off-by: Colin Ian King > > > --- > > > drivers/clocksource/timer-davinci.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksourc= e/timer-davinci.c > > > index a9ca02390b66..8512f12e250a 100644 > > > --- a/drivers/clocksource/timer-davinci.c > > > +++ b/drivers/clocksource/timer-davinci.c > > > @@ -300,6 +300,7 @@ int __init davinci_timer_register(struct clk *clk= , > > > "clockevent/tim12", clockevent); > > > if (rv) { > > > pr_err("Unable to request the clockevent interrupt"); > > > + kfree(clockevent); > > > return rv; > > > } > > > > > > -- > > > 2.20.1 > > > > > > > Hi Colin, > > > > I omitted the error checking in this driver on purpose - it doesn't > > make sense as the system won't boot without a timer. > > One way to silence these static checker warnings is to use > "GFP_KERNEL | __GFP_NOFAIL". > > regards, > dan carpenter > Noted, I'll be sending a new version of this driver to Daniel anyway, so I'll include it. Thanks, Bart