From patchwork Mon Jan 30 05:02:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shailendra.v@samsung.com X-Patchwork-Id: 9544471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D181E60415 for ; Mon, 30 Jan 2017 05:13:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C167D26BE9 for ; Mon, 30 Jan 2017 05:13:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2B8D26E97; Mon, 30 Jan 2017 05:13:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25E0D26BE9 for ; Mon, 30 Jan 2017 05:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbdA3FNi (ORCPT ); Mon, 30 Jan 2017 00:13:38 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:35483 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbdA3FNh (ORCPT ); Mon, 30 Jan 2017 00:13:37 -0500 Received: from epcas4p3.samsung.com (unknown [182.195.41.33]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKK00N91U05OM60@mailout3.samsung.com>; Mon, 30 Jan 2017 14:02:29 +0900 (KST) Received: from epsmges4p8.samsung.com (unknown [182.195.42.40]) by epcas4p4.samsung.com (KnoxPortal) with ESMTP id 20170130050228epcas4p4972d129f823330b19a61f383c456f860~edBI6pmtr2338823388epcas4p4W; Mon, 30 Jan 2017 05:02:28 +0000 (GMT) Received: from epcas4p2.samsung.com ( [182.195.41.32]) by epsmges4p8.samsung.com (EPCPMTA) with SMTP id B1.FE.06428.4E8CE885; Mon, 30 Jan 2017 14:02:28 +0900 (KST) Received: from epsmgmsp04.samsung.com (unknown [182.195.34.25]) by epcas4p1.samsung.com (KnoxPortal) with ESMTP id 20170130050228epcas4p1b880b1ae599b7f7d6c60a4b0554a2162~edBIly36f1112911129epcas4p1_; Mon, 30 Jan 2017 05:02:28 +0000 (GMT) X-AuditID: b6c32a28-f79196d00000191c-5a-588ec8e4a7d1 Received: from srin.p4 (Unknown_Domain [107.108.168.37]) by epsmgmsp04.samsung.com (EPCPMTA) with SMTP id A8.74.04872.4D8CE885; Mon, 30 Jan 2017 14:02:28 +0900 (KST) From: Shailendra Verma To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Kukjin Kim , Krzysztof Kozlowski , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma , Shailendra Verma Subject: [PATCH] Gpu: drm: exynos - Fix possible NULL derefrence. Date: Mon, 30 Jan 2017 10:32:03 +0530 Message-id: <1485752523-30029-1-git-send-email-shailendra.v@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsWy7bCmgu6TE30RBotaNS16z51ksrg/7Ru7 xZWv79ksJt2fwGLx5u0aJosX9y6yWPQ/fs1scf78BnaLs01v2C02Pb7GanF51xw2ixnn9zFZ 7JjSymJxa95MNotF314xW8yY/JLNQcBj56y77B6bVnWyeWz/9oDV4373cSaPzUvqPbb0A8X7 tqxi9P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wQtpjEhXvr2boY uTiEBJYzSsz5MpMVJMEmYCjxuu8vE0hCROATi8Tsd78YQRLCAo4SLQ9/sYHYLAKqEn/vNIHF eQU8JP707AGyOYCmKkjMmWQzgZFzASPDKkax1ILi3PTc4gIDE73ixNzi0rx0veT83E2MwBDf dlhJcgfjqhVehxgFOBiVeHgddvVFCLEmlhVX5h5ilOBgVhLhLd8JFOJNSaysSi3Kjy8qzUkt PsRoCrR9IrOUaHI+MP7ySuINTUwtLCxMLI2NjS1MlMR5Y6c/CxcSSE8sSc1OTS1ILYLpY+Lg lGpgnFPKoHQqPsv8+ix+vjdGIdKHLDWt76omzZJcHXWO4+08rvTTs/xily1wS1u56GefQaTD rOzsebt2hYgFXvKv6bNNevOWtU2uuiXnR/XpNRUs83cqxN/Y232X87E3Y+Az67vr/sve/L48 JnUhX8upnvoEowNb/8ef0ajMT1h8RWbBD9bZ8VWWSizFGYmGWsxFxYkAweIknYcCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170130050228epcas4p1b880b1ae599b7f7d6c60a4b0554a2162 X-Msg-Generator: CA X-Sender-IP: 182.195.34.25 X-Local-Sender: =?UTF-8?B?U2hhaWxlbmRyYSBWZXJtYRtTUkktTm9pZGEtQ29tbWVyY2lh?= =?UTF-8?B?bCBSJkQgIFN5c3RlbSBTL1cgR3JvdXAb7IK87ISx7KCE7J6QG0xlYWQgRW5n?= =?UTF-8?B?aW5lZXIvQ29ycG9yYXRlIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?U2hhaWxlbmRyYSBWZXJtYRtTUkktTm9pZGEtQ29tbWVyY2lh?= =?UTF-8?B?bCBSJkQgIFN5c3RlbSBTL1cgR3JvdXAbU2Ftc3VuZyBFbGVjdHJvbmljcxtM?= =?UTF-8?B?ZWFkIEVuZ2luZWVyL0NvcnBvcmF0ZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElaMDFJWjAxODEyMA==?= CMS-TYPE: 104P X-HopCount: 7 X-CMS-RootMailID: 20170130050228epcas4p1b880b1ae599b7f7d6c60a4b0554a2162 X-RootMTR: 20170130050228epcas4p1b880b1ae599b7f7d6c60a4b0554a2162 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_device_get_match_data could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index e07cb1f..fba0ffc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1765,6 +1765,10 @@ static int exynos_dsi_probe(struct platform_device *pdev) dsi->dev = dev; dsi->driver_data = of_device_get_match_data(dev); + if (!dsi->driver_data) { + dev_err(dev, "no device match found\n"); + return -ENODEV; + } ret = exynos_dsi_parse_dt(dsi); if (ret) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index e2e4051..f568234 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -1076,6 +1076,10 @@ static int fimd_probe(struct platform_device *pdev) ctx->dev = dev; ctx->suspended = true; ctx->driver_data = of_device_get_match_data(dev); + if (!ctx->driver_data) { + dev_err(dev, "no device match found\n"); + return -ENODEV; + } if (of_property_read_bool(dev->of_node, "samsung,invert-vden")) ctx->vidcon1 |= VIDCON1_INV_VDEN; diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 38eaa63..27aeb74 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1837,6 +1837,10 @@ static int hdmi_probe(struct platform_device *pdev) return -ENOMEM; hdata->drv_data = of_device_get_match_data(dev); + if (!hdata->drv_data) { + dev_err(dev, "no device match found\n"); + return -ENODEV; + } platform_set_drvdata(pdev, hdata); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index edb20a3..b3c6bbb 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1205,6 +1205,10 @@ static int mixer_probe(struct platform_device *pdev) } drv = of_device_get_match_data(dev); + if (!drv) { + dev_err(dev, "no device match found\n"); + return -ENODEV; + } ctx->pdev = pdev; ctx->dev = dev;