From patchwork Tue Aug 16 09:27:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9283029 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 19E7760574 for ; Tue, 16 Aug 2016 09:27:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A13928606 for ; Tue, 16 Aug 2016 09:27:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2E9E28CA8; Tue, 16 Aug 2016 09:27:57 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 96AD528606 for ; Tue, 16 Aug 2016 09:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753258AbcHPJ1b (ORCPT ); Tue, 16 Aug 2016 05:27:31 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33422 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753240AbcHPJ1a (ORCPT ); Tue, 16 Aug 2016 05:27:30 -0400 Received: by mail-wm0-f66.google.com with SMTP id o80so15388224wme.0; Tue, 16 Aug 2016 02:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PJJ9WXywdYCGwTLkAQxc8af7PhHYosy/KvtXYdNom3U=; b=aZ8fws5nudRF+H5FMTo+VEvpPQveZ5u0wemf9rjV+GUqNvvZIdaNi2aAq4JAg1KQ8Y O4eZTVjFspQqukHjilCzh9gidaEp2XinF3SYVvBpXze8yeWbZrTC9mxKhGdvqifr9x9b ix3S0J8SdDA4ssG/XNNY7GN4FFw0smIgjtbp0v+kAPrcQYURCgPGKura5yFKEKrRxOaS lAiuMwZWxnZrOOe444Ue5IqQpVz5A4J+YgxP33Nxfl3hyRlRdZoI3yhGsD8wYhzfOmoP J13xvg+ICkE1ocZXRaTAkz2QQw8H96kkOEJZ8gkcdgQlP847QLxdN/qZRJHB62p6EQGx NQwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PJJ9WXywdYCGwTLkAQxc8af7PhHYosy/KvtXYdNom3U=; b=YQEiEqJ7YocdpS+HKUGJvZUT647oIKF/bdSoyzt0ERmsTeyl+i/ZHvoSOj+qJvNUy2 N66ytn1PZomlf5AHtMocplUFJSBLzFG5QSa+fHTvYOkmJS5bwuG/EBaxOFVusA/FXTPD cQBKucp05/6RMoD2vsr3L/+tmytTxwdSRwGsBTxs13oJBLeWSrtgZuThuHwfUCzDCeAC YCncEduG6mOi2FqwMy26PNuW0j9bEJc58OPbQGhyq/w3KmAEurG1Dij4BnnzvIt2+jV2 w88oBbziA5HRM9CEfqHjcJB7JO/54SV5dw2bj4r+DM0CGHcjZtC/N4YvWbcN6RNs27BD oY5Q== X-Gm-Message-State: AEkooutTG6x9piOC22J5N5iQ9Ie55QttxMU8HupIcz9SCfWbw3fIbsVKcHgToFoOMvYh5A== X-Received: by 10.28.47.7 with SMTP id v7mr19858523wmv.38.1471339648782; Tue, 16 Aug 2016 02:27:28 -0700 (PDT) Received: from Red.local (ANice-651-1-389-119.w86-205.abo.wanadoo.fr. [86.205.21.119]) by smtp.googlemail.com with ESMTPSA id a184sm21602754wmh.1.2016.08.16.02.27.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Aug 2016 02:27:28 -0700 (PDT) From: LABBE Corentin To: plagnioj@jcrosoft.com, tomi.valkeinen@ti.com Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, LABBE Corentin Subject: [PATCH 2/2] fbdev: ssd1307fb: fix a possible NULL dereference Date: Tue, 16 Aug 2016 11:27:18 +0200 Message-Id: <1471339638-25134-2-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1471339638-25134-1-git-send-email-clabbe.montjoie@gmail.com> References: <1471339638-25134-1-git-send-email-clabbe.montjoie@gmail.com> 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_match_device could return NULL, and so cause a NULL pointer dereference later. For fixing this problem, we use of_device_get_match_data(), this will simplify the code a little by using a standard function for getting the match data. Signed-off-by: LABBE Corentin --- drivers/video/fbdev/ssd1307fb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index b6c9ecf..4265035 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -559,8 +559,7 @@ static int ssd1307fb_probe(struct i2c_client *client, par->info = info; par->client = client; - par->device_info = of_match_device(ssd1307fb_of_match, - &client->dev)->data; + par->device_info = of_device_get_match_data(&client->dev); par->reset = of_get_named_gpio(client->dev.of_node, "reset-gpios", 0);