Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2725974imj; Mon, 11 Feb 2019 07:34:05 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib0OTlmVl6/FctomCvNOlCXOOjIw1mq/eHdq/LTKqYeJyYFm5jvIrHKq+lgHXQDwd0FuDyq X-Received: by 2002:a17:902:bc83:: with SMTP id bb3mr23002960plb.266.1549899245239; Mon, 11 Feb 2019 07:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899245; cv=none; d=google.com; s=arc-20160816; b=mzecOnUsFCPUCCJdBpcQoj39JbFXdROdSZ+F1PBJA2/vtIM9WUzuYLmYmC1460sBfY pitcVxp+dWWrrBdo4lWur/tuLy0MfuZmBa2wUMrmnqPtamU59g24qEt+HOYmZ9OO1NwU OnQeTBHrCBeg9tF+xh+dIshFCUsyCHqtRB+5Osymp5LIbilwOIzXvTXmiA1Lcg5BH0kx 45vZb1+BM3SEsMVJeXxrizMaVidXpc8tziM8VtwZ2Y/8Vtop6l7oV5P706vbN4uyEEas OrQ/TYOmSAdJ24WyOZwZtPm2tCN+dEWBikbGxmsRIXqa77wtUULoSptKtREYCAR8tDDB J4LA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tfYti+rc3zNZ1Y52FBZxvmvLveED30vLdtVzEFa7J28=; b=z5OxPOpo+MLzdA1IwOsGZbw19dXKRSm/LCKwiscogdMiC+uFrhmfRcwHh0Q6Mb2Zop wwInEEp03RzFTvu/6vrPu/qUm439gQvaFc2SNL/M3DxBJx4tkF1RMOYjPVHtRwyJQHMZ w3MNX6O6tYN+wxCMJZU7Y8I0gFk1riYIKRnKAid5EVxQ09LREf0zyYXz2qNFuPkWSbPc tQg95gXUvYwu0gWMVfZDHwPawYqw2Q8r6gWq4B0ml4ideKem38MpnlsEuUbFsKOQdokE m3bHDINA3k7qCfkIFchoK3q+y1gDOdwvjfo4wGLwkBL1XO+ow66Eas6m2+nGcypGSU5J ONBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ILPLojJz; 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 p5si8819637pgc.558.2019.02.11.07.33.48; Mon, 11 Feb 2019 07:34:05 -0800 (PST) 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=@kernel.org header.s=default header.b=ILPLojJz; 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 S2388388AbfBKOyW (ORCPT + 99 others); Mon, 11 Feb 2019 09:54:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:41020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388801AbfBKOyU (ORCPT ); Mon, 11 Feb 2019 09:54:20 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7ADD5222A5; Mon, 11 Feb 2019 14:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896859; bh=e5HRXNyqe3Eevif5rTG9KXVQkQgi5QKUkfwTdMMHcBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ILPLojJzgz2ywFfUVCfEoyxqPFsH/aIzWHkPY3TYI7t5e0qQizPvuvGscDHCmhVrB kkihYcWjWedOeP41KoyxwDEgbAbnQnste+AGXksIjSGv2We+aSY8WEnGwtFgvVaBwm ScKp0BHc71vRO/Aca6590uGyWIU7WzYxpHUO9/uE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Wang , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 012/205] clk: boston: fix possible memory leak in clk_boston_setup() Date: Mon, 11 Feb 2019 15:16:50 +0100 Message-Id: <20190211141827.953673980@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 46fda5b5067a391912cf73bf3d32c26b6a22ad09 ] Smatch report warnings: drivers/clk/imgtec/clk-boston.c:76 clk_boston_setup() warn: possible memory leak of 'onecell' drivers/clk/imgtec/clk-boston.c:83 clk_boston_setup() warn: possible memory leak of 'onecell' drivers/clk/imgtec/clk-boston.c:90 clk_boston_setup() warn: possible memory leak of 'onecell' 'onecell' is malloced in clk_boston_setup(), but not be freed before leaving from the error handling cases. Signed-off-by: Yi Wang Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/imgtec/clk-boston.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imgtec/clk-boston.c b/drivers/clk/imgtec/clk-boston.c index 15af423cc0c9..f5d54a64d33c 100644 --- a/drivers/clk/imgtec/clk-boston.c +++ b/drivers/clk/imgtec/clk-boston.c @@ -73,27 +73,32 @@ static void __init clk_boston_setup(struct device_node *np) hw = clk_hw_register_fixed_rate(NULL, "input", NULL, 0, in_freq); if (IS_ERR(hw)) { pr_err("failed to register input clock: %ld\n", PTR_ERR(hw)); - return; + goto error; } onecell->hws[BOSTON_CLK_INPUT] = hw; hw = clk_hw_register_fixed_rate(NULL, "sys", "input", 0, sys_freq); if (IS_ERR(hw)) { pr_err("failed to register sys clock: %ld\n", PTR_ERR(hw)); - return; + goto error; } onecell->hws[BOSTON_CLK_SYS] = hw; hw = clk_hw_register_fixed_rate(NULL, "cpu", "input", 0, cpu_freq); if (IS_ERR(hw)) { pr_err("failed to register cpu clock: %ld\n", PTR_ERR(hw)); - return; + goto error; } onecell->hws[BOSTON_CLK_CPU] = hw; err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, onecell); if (err) pr_err("failed to add DT provider: %d\n", err); + + return; + +error: + kfree(onecell); } /* -- 2.19.1