From patchwork Mon Jan 30 05:00:58 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: 9544455 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 2FD6860415 for ; Mon, 30 Jan 2017 05:04:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2357A20265 for ; Mon, 30 Jan 2017 05:04:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17BFD2711E; Mon, 30 Jan 2017 05:04:20 +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 9FB3E20265 for ; Mon, 30 Jan 2017 05:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752187AbdA3FES (ORCPT ); Mon, 30 Jan 2017 00:04:18 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:49933 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbdA3FDj (ORCPT ); Mon, 30 Jan 2017 00:03:39 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKK003KRTZ02F50@mailout1.samsung.com>; Mon, 30 Jan 2017 14:01:48 +0900 (KST) Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20170130050148epcas1p26b50ff3e8e4cf6203f61bf65d9e707d3~edAjdmoTz2196021960epcas1p2Y; Mon, 30 Jan 2017 05:01:48 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 30.4F.06735.CB8CE885; Mon, 30 Jan 2017 14:01:48 +0900 (KST) Received: from epsmgmsp01.samsung.com (unknown [182.195.34.22]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20170130050148epcas1p14f6149d6f0b6f24dc31506ede089724c~edAjSkd7E2590925909epcas1p1Z; Mon, 30 Jan 2017 05:01:48 +0000 (GMT) X-AuditID: b6c32a36-f79dd6d000001a4f-84-588ec8bc715d Received: from srin.p4 (Unknown_Domain [107.108.168.37]) by epsmgmsp01.samsung.com (EPCPMTA) with SMTP id 2E.64.04803.F98CE885; Mon, 30 Jan 2017 14:01:48 +0900 (KST) From: Shailendra Verma To: Tomi Valkeinen , LABBE Corentin , Julian Scheel , Julia Lawall , Boris Brezillon , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, p.shailesh@samsung.com, ashish.kalra@samsung.com, Shailendra Verma , Shailendra Verma Subject: [PATCH] Video: fbdev - Fix possible NULL derefrence. Date: Mon, 30 Jan 2017 10:30:58 +0530 Message-id: <1485752458-29955-1-git-send-email-shailendra.v@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7bCmru6eE30RBg0fZCzuT/vGbnHgxUIW i79/Ky2WPTjNaPGhrZvd4kTfB1aLy7vmsFnsmNLKYnFr3kw2i0XfXjFbrJ9/i82B2+PJpouM Hjtn3WX3eHD4CovH3i1ZHn1bVjF6HL+xncnj8ya5APYoLpuU1JzMstQifbsErozf6/exFaxk q1j65wpTA+MK1i5GTg4JAROJ1bt6GCFsMYkL99azdTFycQgJ7GCUaJi2lRXC+cwoceF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XGBjqFSfmFpfmpesl5+duYgSG6bbDSmI7GNtWeB1iFOBgVOLhNVjTFyHEmlhWXJl7 iFGCg1lJhLd8J1CINyWxsiq1KD++qDQntfgQoynQ9onMUqLJ+cAYyiuJNzQxtbCwMLE0Nja2 MFES542d/ixcSCA9sSQ1OzW1ILUIpo+Jg1OqgTGpkP/2ugWlp+cfS9rit+H/dNe5aU9W2e1x Et67RKWKUXn/fEbXe1xM5Rv2KfrlSBSVnajQX3crksE/bcHKsgLXv/cWJ18xOT9BJ0Zg1+yL byX52B/OYb2eY76i8siyAAsJwZgp7zQeB1msKz1r61RveCU8sKpof9iSRbrBIonvUiSlWSt9 7yuxFGckGmoxFxUnAgDcQHJ3aQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170130050148epcas1p14f6149d6f0b6f24dc31506ede089724c X-Msg-Generator: CA X-Sender-IP: 182.195.34.22 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: 101P X-HopCount: 7 X-CMS-RootMailID: 20170130050148epcas1p14f6149d6f0b6f24dc31506ede089724c X-RootMTR: 20170130050148epcas1p14f6149d6f0b6f24dc31506ede089724c References: Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@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/video/fbdev/ssd1307fb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 2925d5c..bdf7d80 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -560,6 +560,10 @@ static int ssd1307fb_probe(struct i2c_client *client, par->client = client; par->device_info = of_device_get_match_data(&client->dev); + if (!par->device_info) { + dev_err(&client->dev, "no device match found\n"); + return -ENODEV; + } par->reset = of_get_named_gpio(client->dev.of_node, "reset-gpios", 0);