Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2181355ybd; Mon, 24 Jun 2019 02:06:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoDomc5q2CraPCOs5tyAq3pqqOsSY+DmvhMq0K1mLqhJhjlBeibTwt6tNhkUMnGPTXhjIy X-Received: by 2002:a63:6b07:: with SMTP id g7mr32913305pgc.325.1561367187996; Mon, 24 Jun 2019 02:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561367187; cv=none; d=google.com; s=arc-20160816; b=ch45qU3kZDBE0Wjfcd0zt7/yIjyL6CvMA9dd/DXaBXQR166L0UTPuD2vnY5aAEdwLp i1dDqG3ubB8yDV0EF/ZFC3w3F77ueDl8ZJf3JY5DlnHCyII+uu1nyAZNrqKEAfZPjeIp vfcJfTVQ21EuA1cEPkFNVj/XmIJQ58FzDmGV9d8pPQ2oPb1MqEiZswwfdhLBDefFkNhu XgmSr5eabIV9eRXxMXxqoXNU6UBKKd72GT1SGXoLK5GM1PJgDEn56b+htYUVtiLbBd7M +aPd/axABoiZq4VRYn3hpa6kP9ulMMYHs77Uf7gZ9nLEnDgi500wcUkYSGR1ob7vMZGY SOlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iuTIqR77mbkKkua9Khoq/rOSBVnpK6lTjqe4ytlfdQ4=; b=LJ18IZFMLtBFmzDZZJiHl8qCVOEVN/nuoMRAJA26vnZCOoKSSPJAfVnDUJG3zYgMWz C/wF6k4LSo9hNyY11/RtPNPtrRNzVx1v+lanRngi4KXNQ/WsPvms0haSjvqnVdHY9kB3 ES9rywq9QLWlu71kCGTh7g99QPcJMQMMigz/0dewBYqLmLVFikFZwgnZ9m+fTGhVbtH/ 7cP2k00Sxcwg79sgcPA91jIi8ATRvhwTYR0/AFHpRpC1XQQjxIwKk+7FX2KG5DOPiKX7 XqIyM0HBuBhG9sklXSURN6XwZtGcBG5Xkf8xVHY8Lw3RtfhvOkZlMxlfNyvh1MaVREq4 kgKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=kuVsG8x7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si9045192pls.389.2019.06.24.02.06.11; Mon, 24 Jun 2019 02:06:27 -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=@oracle.com header.s=corp-2018-07-02 header.b=kuVsG8x7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbfFXJEE (ORCPT + 99 others); Mon, 24 Jun 2019 05:04:04 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:59518 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfFXJED (ORCPT ); Mon, 24 Jun 2019 05:04:03 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5O8xEXL054804; Mon, 24 Jun 2019 09:03:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=corp-2018-07-02; bh=iuTIqR77mbkKkua9Khoq/rOSBVnpK6lTjqe4ytlfdQ4=; b=kuVsG8x7IGwY4wUYyOPzJtOzGjq5c/LqHnlZGpSMt266hRfT4/+4gsewBWAWhx+mcDB7 f+PQ7QzF7wttbkrOALL6WNiuNqBMqhqj11EOTIof2o1T4RATUIyWS+5tOjwRZgIoEZpu 5GlBqqsByKYvhEt2erupYOxVuhMYgrmLwjerNJGLKNkRmPuhKiHZUEDqBtNm68sm4kYq AhPNI2bAVPM/ECus8iU8jl7ouU42fSVSN/X5L2oWPHEJCG/ruKooiQaaCh5FaeYCNBxK mD9mCbc958KUDuabRWL/t6ZlFdlrp9YcxZb3HhaT6CyOpgVQwOeVDXAVcXCg/C/7P+9D hA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2t9c9pd4nt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 09:03:50 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5O93Orw048583; Mon, 24 Jun 2019 09:03:49 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2tat7bhdau-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 09:03:49 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5O93k96008205; Mon, 24 Jun 2019 09:03:46 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Jun 2019 02:03:45 -0700 Date: Mon, 24 Jun 2019 12:03:39 +0300 From: Dan Carpenter To: Bartosz Golaszewski Cc: Colin King , Daniel Lezcano , Thomas Gleixner , kernel-janitors@vger.kernel.org, LKML Subject: Re: [PATCH][next] clocksource: davinci-timer: fix memory leak of clockevent on error return Message-ID: <20190624090339.GW28859@kadam> References: <20190617113109.24689-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9297 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240076 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9297 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906240075 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 24, 2019 at 10:28:10AM +0200, Bartosz Golaszewski wrote: > pon., 17 cze 2019 o 13:31 Colin King napisaƂ(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 clockevents") > > 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/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