From patchwork Tue Oct 1 13:09:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 174860 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp8525763ill; Tue, 1 Oct 2019 06:09:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3kS52oKB1NzA2B4Usa/XwEo0H+isewVVgsvqkKhIa2usEoPUBP0PDPcQOa3T+HHCJA+cF X-Received: by 2002:aa7:c4d0:: with SMTP id p16mr25485186edr.266.1569935373029; Tue, 01 Oct 2019 06:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569935373; cv=none; d=google.com; s=arc-20160816; b=SZ689MdgHtdUp7GPm/Vx8ul3O+VLBp2MKkR/xwF4w9NTxsMnbI1JzVl+7JVk+AzJaC W814NDupWy6zRvphy8mLwIrGNhb7T5Gdw64Qtg7edd5OOp0d3/RkN0FDpU6oqKYxOMGv kvFXvQMmjN5RKOXE5rPM8SeW4nY6GJsCOF2E4+0SyXR5BqrYJSazFGifWerbeku2hZUv RGOE/A0PMmtp7XfRtycQbH8B+GSvgLLvm18LIBhNgpERCoAkbDPEDMHVwnUUzBeUrnW6 55/utuxMWsNFmXyrfYkja++Ie5BxwXgWQGm1G8Fv8mpy5SojwAMJuWNzuo44t3chz+Oe /K8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=3dXebAaNExUfKzVX+nSBB4G6POEd8p2Rl7wFL/2vhKY=; b=jot20tbfZvrx92dQCzi4EirR3nQm0ojVZoc6q/fpHenF23x6hHjUZ43rSjV2nAAx76 mIze/9OjK91dgtnJTJc/rKnnmKr5esXRVPnFKUZZQ+gNKRf11KE0r/cZTCq4ksi4LB/3 R8bLBHrps0FPtdV0Ql5JDOpHJqXQL7P7uN6giENOdQLeH37chFqt8GzNvvEhxhmiU77m a6aqVdADZc/XB2BQ5A6GB1PRjeFl4gBdqXMwMrwA+BbMVM02CamHEabDRhS1/VSlDW+C t+Vp0APAgPKsIJdudXrrKrn+Fg2Z2uGN6Sh2RcYBSEvfOk6IYyLmtzn4X0m7d75RKuY+ zugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=sNFywzjz; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si8799479ejk.20.2019.10.01.06.09.32; Tue, 01 Oct 2019 06:09:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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=@samsung.com header.s=mail20170921 header.b=sNFywzjz; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbfJANJc (ORCPT + 3 others); Tue, 1 Oct 2019 09:09:32 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:37383 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbfJANJb (ORCPT ); Tue, 1 Oct 2019 09:09:31 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191001130930euoutp015b9270278038c562d7fab253194a3fb1~Jh_bMmhrs0351903519euoutp019 for ; Tue, 1 Oct 2019 13:09:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191001130930euoutp015b9270278038c562d7fab253194a3fb1~Jh_bMmhrs0351903519euoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1569935370; bh=3dXebAaNExUfKzVX+nSBB4G6POEd8p2Rl7wFL/2vhKY=; h=From:To:Cc:Subject:Date:References:From; b=sNFywzjzJgEAD3ZhDhi59eGWnclkA/2jP+W27K1BaCdfXTcP98YejqO45n52h+epM MtV25a7sKUe9E2K96kDAxAH3E+APtHPkmMtrQRzlcAtY2DWlZR3g6EPsbUQM7tldLW yFrHneuhlN2c5l+dR05wH436LArqI+ZiKs1ZSkFU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20191001130929eucas1p2fd508d892d70e2832ed7a4299a7588fc~Jh_apGPHs1940819408eucas1p26; Tue, 1 Oct 2019 13:09:29 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A6.A9.04469.900539D5; Tue, 1 Oct 2019 14:09:29 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191001130929eucas1p114d229f779680122c629396a4fc040c0~Jh_aTTxQA2227822278eucas1p1o; Tue, 1 Oct 2019 13:09:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191001130929eusmtrp24f9eeb97be8f337c2ae243ebcdba80ad~Jh_aSqit-0780007800eusmtrp2T; Tue, 1 Oct 2019 13:09:29 +0000 (GMT) X-AuditID: cbfec7f2-569ff70000001175-e3-5d93500988bc Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id DD.DF.04166.900539D5; Tue, 1 Oct 2019 14:09:29 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191001130928eusmtip24d4ffb4391a02d4cfcad14ad2d8e58b0~Jh_Z0-EcS0170101701eusmtip22; Tue, 1 Oct 2019 13:09:28 +0000 (GMT) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH] clk: samsung: exynos5433: Fix potential NULL pointer dereference Date: Tue, 1 Oct 2019 15:09:21 +0200 Message-Id: <20191001130921.24571-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djP87qcAZNjDb7tNrDYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVsfuzfcEptoo/C4+xNjDuZu1i5OSQEDCRWLV5PWMXIxeHkMAKRolzRyazQjhfGCX+ 7exhhnA+M0rsf3uDBaZl3vuVUInljBK3WncxwbWcWPuDEaSKTcBQouttFxuILSLgIPH502uw JcwCjxkltp78CtTOwSEsECxx/h8zSA2LgKpE/6HlYPW8ArYSWzpesUNsk5dYveEA2DYJgRNs En/m/GcF6ZUQcJF4+1ofokZY4tXxLVD1MhL/d85ngqhvZpR4eG4tO4TTwyhxuWkGI0SVtcTh 4xfBBjELaEqs3wU1yFHiw6s/LBDz+SRuvBUECTMDmZO2TWeGCPNKdLQJQVSrScw6vg5u7cEL l5ghbA+JzqXzmEBsIYFYiT8Nz1gmMMrNQti1gJFxFaN4amlxbnpqsWFearlecWJucWleul5y fu4mRmDcn/53/NMOxq+Xkg4xCnAwKv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yixFGckGmoxFxUnAgCma4FWTQIAAA== X-CMS-MailID: 20191001130929eucas1p114d229f779680122c629396a4fc040c0 X-Msg-Generator: CA X-RootMTR: 20191001130929eucas1p114d229f779680122c629396a4fc040c0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191001130929eucas1p114d229f779680122c629396a4fc040c0 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org devm_kcalloc might fail, so avoid accessing the allocated object in such case. Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-exynos5433.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 Acked-by: Chanwoo Choi diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c index 7824c2ba3d8e..6afbcd0ae96f 100644 --- a/drivers/clk/samsung/clk-exynos5433.c +++ b/drivers/clk/samsung/clk-exynos5433.c @@ -5592,7 +5592,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev) if (data->nr_pclks > 0) { data->pclks = devm_kcalloc(dev, sizeof(struct clk *), data->nr_pclks, GFP_KERNEL); - + if (!data->pclks) + return -ENOMEM; for (i = 0; i < data->nr_pclks; i++) { struct clk *clk = of_clk_get(dev->of_node, i);