From patchwork Fri Jan 27 11:25:59 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: 9541431 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 2635F601D7 for ; Fri, 27 Jan 2017 11:29:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17B1820649 for ; Fri, 27 Jan 2017 11:29:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C13627F9F; Fri, 27 Jan 2017 11:29:14 +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 BAD8D20649 for ; Fri, 27 Jan 2017 11:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932521AbdA0L3I (ORCPT ); Fri, 27 Jan 2017 06:29:08 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:52897 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932625AbdA0L2t (ORCPT ); Fri, 27 Jan 2017 06:28:49 -0500 Received: from epcas3p4.samsung.com (unknown [182.195.41.22]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKF007D7RS3KL20@mailout1.samsung.com>; Fri, 27 Jan 2017 20:26:27 +0900 (KST) Received: from epsmges3p9.samsung.com (unknown [182.195.42.23]) by epcas3p1.samsung.com (KnoxPortal) with ESMTP id 20170127112627epcas3p162c7ca72c41cf0526a7426b73bcc23c9~dnUig1waS1797417974epcas3p1e; Fri, 27 Jan 2017 11:26:27 +0000 (GMT) Received: from epcas3p4.samsung.com ( [182.195.41.22]) by epsmges3p9.samsung.com (EPCPMTA) with SMTP id D1.E3.04848.36E2B885; Fri, 27 Jan 2017 20:26:27 +0900 (KST) Received: from epsmgmsp03.samsung.com (unknown [182.195.34.24]) by epcas3p1.samsung.com (KnoxPortal) with ESMTP id 20170127112626epcas3p137caa1e5fdbf0bb07ae5f057bf819828~dnUhfA14q2600926009epcas3p1M; Fri, 27 Jan 2017 11:26:26 +0000 (GMT) X-AuditID: b6c32a17-f794a6d0000012f0-de-588b2e63afaa Received: from srin.p4 (Unknown_Domain [107.108.168.37]) by epsmgmsp03.samsung.com (EPCPMTA) with SMTP id 9E.2D.04880.06E2B885; Fri, 27 Jan 2017 20:26:26 +0900 (KST) From: Shailendra Verma To: Dan Williams , Vinod Koul , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma , Shailendra Verma Subject: [PATCH] Dma - Fix possible NULL derefrence. Date: Fri, 27 Jan 2017 16:55:59 +0530 Message-id: <1485516359-4232-1-git-send-email-shailendra.v@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsWy7bCmmG6yXneEwZJuEYv7076xW0yfeoHR YvXUv6wWl3fNYbPYMaWVxeLWvJlsFou+vWK2eNm3n8WBw2PnrLvsHov3vGTy6NuyitHj8ya5 AJYoLpuU1JzMstQifbsErox1Sz6wFdxhrXh6aDN7A+Mlli5GTg4JAROJbadOsELYYhIX7q1n 62Lk4hASWMoocWrPFEYI5zOjxPulu5lhOla0d0FVrWSUmP1gHjtIgk3AUOJ1318mkISIwEIm iVdX7zCBJISBOs6+awfrZhFQldg0eTvYbl4Bd4kNG/uAbA6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amFhYWJpbGxsYWJkjhv7PRn4UIC6YklqdmpqQWpRTB9TBycUg2MJVxlUeet LZp3rv+aWeh4cPLdQiH7Qr05W//1d7xZofPrk1a4WdjyoqNrY/qUUp/d+LKqc//ECVwp304G C1sGei9yKwhZH3nz7R6mOUVW/2ovSR2y7DLXuvBISPLs8e0RLOunryuaGyQ920Dxx37jjJpL Fv9vThbbfFDl6Pplkpx7Yl1OzhH/rcRSnJFoqMVcVJwIAJqMMtJNAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170127112626epcas3p137caa1e5fdbf0bb07ae5f057bf819828 X-Msg-Generator: CA X-Sender-IP: 182.195.34.24 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: 103P X-HopCount: 7 X-CMS-RootMailID: 20170127112626epcas3p137caa1e5fdbf0bb07ae5f057bf819828 X-RootMTR: 20170127112626epcas3p137caa1e5fdbf0bb07ae5f057bf819828 References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_match_device could return NULL, and so cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma --- drivers/dma/mv_xor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 23f7528..c25b3bb 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1323,7 +1323,10 @@ static int mv_xor_probe(struct platform_device *pdev) const struct of_device_id *of_id = of_match_device(mv_xor_dt_ids, &pdev->dev); + if (!of_id) { + dev_err(&pdev->dev, "Error: No device match found\n"); + return -ENODEV; + } xordev->xor_type = (uintptr_t)of_id->data; } --