From patchwork Wed May 18 20:31:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 9124681 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 355579F1D3 for ; Thu, 19 May 2016 08:00:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6281720219 for ; Thu, 19 May 2016 08:00:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4B60E20225 for ; Thu, 19 May 2016 08:00:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EB526E946; Thu, 19 May 2016 08:00:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6CBF6E218 for ; Wed, 18 May 2016 20:31:55 +0000 (UTC) Received: from LT001.lan ([62.143.92.134]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0Meg8W-1bE3Iu01t2-00OI9p; Wed, 18 May 2016 22:31:52 +0200 From: Heinrich Schuchardt To: Patrik Jakobsson , David Airlie Subject: [PATCH 1/1] drm/gma500: mdfld: avoid possible null pointer dereference Date: Wed, 18 May 2016 22:31:43 +0200 Message-Id: <1463603503-5059-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:1zUR0SNGwbUBM+ySh48tFcLcWyU9nwELCyiQLUhJxN4imYe6TZw Dpcz7qd7FTcRaoicdXzvySsynjIaKkl//GeVPY9CriLhgDmaeBzi12OWLGc6pRYCgkg3Ttv +Jgo+zaOon4D8uwi9IPG6PDwrC9VSl2CMa/zm9R1gQSGQ1P3C1BeIJTib+A6cIld8T7gpCr rCGLKj3desX0VDE9j/XIQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:NxpsPqKF2ic=:Z3F126pUfBj82NgcvEknR6 5t5KkwqNjO9EifbjFx49wbu03lgmP1HO9z8ph6eUXUU+WmOaTbbqPi9XZibRaWwZjScehfCtr nX8q1Jpq6NiPNbnMP9pS0ekr3v6YX8c04/WXZpkCXXDx+R8T20j6osj5Jw4XYxqgmUivQBrVE 4oy77rPCDqF3O29y+WIqYQvjLKOdded+tLKMglNDkdb4RMJWvYi997buP8dw030F1O0TgxMt4 mQuNjma4iiRBy42sDuXZOjRrKx+qcPkpK/FM6ZSNKmslX9TVhd7s2TZGNGzY4q+VX3s8puhPf I/osvtDlDI4bYFUdNuS8XhNYack3Fss0Z+WYb/Vozm+TZ3jvwLZzk44RVF4YEKg6J6bSy1jEB IfTa2B3agiw8zw8FRblTV+ptEBGjS7i2G89ZsHq+fk56Uqq8KdlzSzafoklRGLnJojEor6eaU yBZ480t+GLXl1Bba5CK0VYbC4aIVxZ4gVvs6prxh3x0hvfy3mPlFOPMZFhv3buy6G0QfA9ck0 Noq5483uacG2OCd/1efCkHDupAjyUWaJNgWMgPRn8MYfvhaWQY39tj2G+iceqwdsilTQFdYqD /YOBcH+FcyJf2lAhv2p5g3z4ahcq82aQM/Qt0Mf1aEWPb5LFZV5akL4pSlB2mVqgWIL86QCeX K1oplS4TiM0RLY2U+MV9KLZPzpyn4ykO0Ca3Xa11xH1VuaMq+3jjnc73eGB81xRyk9lh1AZcR 7MgvVea3bvFWcjXc9PQendKcPspdBd05WF9JUViEqY01HczlBMPzLex+irY= X-Mailman-Approved-At: Thu, 19 May 2016 08:00:20 +0000 Cc: Heinrich Schuchardt , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only dereference sender after checking if sender is NULL. Signed-off-by: Heinrich Schuchardt --- drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c index 1616af2..c50534c 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c @@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs) { unsigned long flags; - struct drm_device *dev = sender->dev; + struct drm_device *dev; int i; u32 gen_data_reg; int retry = MDFLD_DSI_READ_MAX_COUNT; @@ -530,6 +530,8 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, return -EINVAL; } + dev = sender->dev; + /** * do reading. * 0) send out generic read request