Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2165731ybd; Mon, 24 Jun 2019 01:48:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8a7Gtj/bJVA5hWB1gwdnaBW3rufDF4B8oOffJ64Du91t//qV3PcoaHmc3YAH280+jb73W X-Received: by 2002:a17:90a:32e4:: with SMTP id l91mr1601637pjb.17.1561366092860; Mon, 24 Jun 2019 01:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561366092; cv=none; d=google.com; s=arc-20160816; b=kBozfQi2ZlYXpvi6TGITVOKHOHsWW43kr0w4JJJJ5WxJcI5yYVNS7qV2acZgScBz/e Aa1txID+2WmmZMBWXdXJlD3KpszYdBJPiraT6EWu9tUl/v4cYz5G4QOL++GtQ4kwqb0u rrRA+l07eBRK3MX5GKbipHdz+pHsLCuahpNR/j6OLhsMvLiuo8KV0c579+MUVZrUvjLi 1Eo0I0KOMPvI0w1/0sbKec/3drE8wYpn6wuxAedOvis3MVax8PXoZFPni938AwuXnoeU MqQrfgvzh0mCzLzxpxz1HqRYIy7IeuEmklap0kLqbElYj5bjhbse3Zlgk5IUW3aMe8mT HV7A== 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=aOYWBoaLwTAQVgKv1wpzsu0smLvbq1hrhMNb9sUg/Dc=; b=QYjJ+3VT8OAKNrFf+P/TFnulKwCD67f8it7hpSmpoPZG2zGo9PkeWgfHgPPlhWT503 fx82e1YXEGLvFbVyCZTjz11FuIKKh5wgb4XY7rjDCdCR41UyfROmkkW2RSsgkSUZVxxC zeGImDhzAZNxS4cgSe5+TbXqG8AQwkurBoI5xFHnYLsTqdBH3JC9Da4rXTlNxsrNpt58 86UaElApwcPGCqaxwnh+qVZLjnuSYNDDoLAg4uc4CVWnwJm9KSMIlGinB04YAkc/sHCk utHTx+ZDwLvjQiKYl15M+8PMKBB6Z8LypTlqKLk8XI5fznfNoCD3+Vn5ByVx/bt5msZE vxTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ZxUTj92w; 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 l3si10121247pff.51.2019.06.24.01.47.57; Mon, 24 Jun 2019 01:48:12 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ZxUTj92w; 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 S1727727AbfFXI2W (ORCPT + 99 others); Mon, 24 Jun 2019 04:28:22 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:39337 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbfFXI2W (ORCPT ); Mon, 24 Jun 2019 04:28:22 -0400 Received: by mail-ot1-f68.google.com with SMTP id r21so12682377otq.6 for ; Mon, 24 Jun 2019 01:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=aOYWBoaLwTAQVgKv1wpzsu0smLvbq1hrhMNb9sUg/Dc=; b=ZxUTj92wU6U7njtskwtF0VBplk2QFyERO4znO5hRAes3vk4U/+ZAR+RJoRI+jrwN6f 7tmfntz4sq7tD1SFggGDPT70Ui51nofjKjjXjWyCwyLjf+dZhPH22btOlR88Sjqy4LAW 3DgcApR0/zJi1WrAyf0SJQ/+G0+Z41ZCo3iUAbSVcGOVdQh/HcHuGrLQesvovM8/ZyYl Jy7mpeVwOuTOidxAk1YV81iPgk3Lu/wtEDPmouMz44bbvMZTOKCyJW1QIBRBvQoiX4LC IaESNxSDO1uDQsTqHGAmjtb/KWbrJ/vLxOmNolvST1XHvC4oRiBPBO/mZralck9/ffGP No2Q== 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=aOYWBoaLwTAQVgKv1wpzsu0smLvbq1hrhMNb9sUg/Dc=; b=KH8SsJLE7W8/dhPNyG/Cgt6qrFPlCVCTNrATJgAkakUa86iDh0+y6LyFcLOLbyDzfb gXBAO3NuRg0vZHXp9HPhyWrjn8PDdoC+Z4mgG+wPmT9itrD0JyNKr2YRw1l3hm6skV2o pSGWC6fCkWx2X03IiUhwJtYtGMHefCtDTC53YXooda3q3M5o7WXW6rGp7PUHFvZkrd18 BjLU6g950hWFYPwwq1Dw8wUUNrxunufpnBB3TXnYNjw2gtn2+tNev5NM+bH9v1q+B7ac 27hJXKZUHdq0UWL48PinSt/OHVkehZ+Ry/WuF2hNOX7B3/HGSDMQvFoeUH4wUA3Ig6t2 GJxg== X-Gm-Message-State: APjAAAXGCerutB4pyVPdPX4PTKAZjpvRg16367SqmMdA/yJwq7sj4255 qS0ZdyGcSfb67ROmlJXnsrb63tLiAdcfPRHmVQtRJw== X-Received: by 2002:a05:6830:1681:: with SMTP id k1mr66217365otr.256.1561364901506; Mon, 24 Jun 2019 01:28:21 -0700 (PDT) MIME-Version: 1.0 References: <20190617113109.24689-1-colin.king@canonical.com> In-Reply-To: <20190617113109.24689-1-colin.king@canonical.com> From: Bartosz Golaszewski Date: Mon, 24 Jun 2019 10:28:10 +0200 Message-ID: Subject: Re: [PATCH][next] clocksource: davinci-timer: fix memory leak of clockevent on error return To: Colin King Cc: 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., 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 of > clockevent on the error return path. Fix this by kfree'ing clockevent. > > Addresses-Coverity: ("Resource leak") > Fixes: fe3b8194f274 ("clocksource: davinci-timer: add support for clockev= ents") > 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/clocksource/ti= mer-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. Bart