Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2666277imm; Wed, 3 Oct 2018 07:25:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV62aOB1ig/dbnrjhDNTngfJaRGq8I7PX/oSEPXJ3W7sQv9Y/YzOynoeE91LDuRwxTEylbPNP X-Received: by 2002:a62:1219:: with SMTP id a25-v6mr1884253pfj.104.1538576745472; Wed, 03 Oct 2018 07:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538576745; cv=none; d=google.com; s=arc-20160816; b=pvaQJZ4ZREisVaZ0+LYwVUe1wFZmbQJYYCQ0F7JS+kNK/3xbpNFSF9aTsF0HFMFoCd Hzho7wHQzo3LtHwy4teaU90WZXOJNgOeM03WDjh81gKNrtEDCvHIzixS9bSGdVQiWGL0 GSrMM6XQgVnSQ6jP/aABshF0korK7cmFO9s10xzcUBfk0r9jGk5rvUxDNBr0n9BAC8vp fvg4wi7SF3Hyvej0iIvKz0T6TELVs/6ckuz3qWhGlakVEAc6yiYnShAUq/42SU3OU/Uw 1KYxyJPqwnKZMj5iiHOaOPjJm6bOqHyXSz4FzugwpMAHwNkqtxtmiIUzau2d3oGb0jZD xNVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=vl2DEfy2wgFRJAsmNOWVzcVcGwuhL9WT9RYIywx3TSU=; b=I28HDi+z2vnqV7BSHViQuvUhSlTRXPxOzUVzn5tMeaUWlsYpLLDK0ouT+b9bUhcUSv idfUzcP2d0xkniGDwCyWEbrfGTyjvns+rGPM2hq30oxVa2SqGKKGsAdv4pF9uMPow1iL iBJfhQWSl9hIt01U8KmnB0YIzBZkPCJZeCsqSqWDXvaRWkuf4xR7ivAuO7RowLpv+kkf vR+6URbD5IFfKhytm5eo7GidDYSgBXAr4TgLXqHqQ2REiaOKyj5CxBwz8/A9dC+lqnjc QKkm/yoq34oSCt9FkIGqbl9wNTE3Hei8I+dffjdorIrHs3qr8c1l/D4BpyIQPbl2EIJa oN1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=vzlIhNc5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20-v6si1554214pgk.579.2018.10.03.07.25.30; Wed, 03 Oct 2018 07:25:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=vzlIhNc5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727151AbeJCVNx (ORCPT + 99 others); Wed, 3 Oct 2018 17:13:53 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:37094 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726943AbeJCVNx (ORCPT ); Wed, 3 Oct 2018 17:13:53 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 8F6D9B015F2 for ; Wed, 3 Oct 2018 16:25:14 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=references:in-reply-to:x-mailer:message-id:date:date:subject :subject:to:from:from; s=dkim; t=1538576714; x=1539440715; bh=7U wdoFW2CQdKadRJsmaRWXkSXt2cuY/sccYjH4avVRo=; b=vzlIhNc5KplcNGUvf7 EhrcDLvqnL9A7k6ba/jADSy44mrB1eo08nZ4LQuqPMAKmaOolEERpnlI2B7lX/f9 ex0c9h9py+W/0loO32eUBh7ow4viz7sQdQ3iIfSGMPx9El2cphVXuXqGl7UOO19N O18ikEn/a+9mFOrVch7E9Cz3w= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.899 X-Spam-Level: X-Spam-Status: No, score=-2.899 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id R2eMN_B0VV6O for ; Wed, 3 Oct 2018 16:25:14 +0200 (CEST) Received: from localhost.localdomain (host128-8-dynamic.21-79-r.retail.telecomitalia.it [79.21.8.128]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 36D6BB00C6C; Wed, 3 Oct 2018 16:25:12 +0200 (CEST) From: Giulio Benetti To: Maxime Ripard Cc: David Airlie , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Giulio Benetti Subject: [PATCH v2 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Date: Wed, 3 Oct 2018 16:24:58 +0200 Message-Id: <20181003142458.33120-2-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003142458.33120-1-giulio.benetti@micronovasrl.com> References: <9a545739-eed5-7af1-3b75-108bdd3427a2@micronovasrl.com> <20181003142458.33120-1-giulio.benetti@micronovasrl.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If using tcon with VGA, tcon->panel will be null(0), this will cause segmentation fault when trying to dereference tcon->panel->connector. Add tcon->panel null check before calling sun4i_tcon0_mode_set_dithering(). Signed-off-by: Giulio Benetti Fixes: f11adcecbd5f ("drm/sun4i: tcon: Add dithering support for RGB565/RGB666 LCD panels") Reviewed-by: Chen-Yu Tsai --- Changes V1->V2: * none drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e4b3bd0307ef..f949287d926c 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -491,7 +491,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, sun4i_tcon0_mode_set_common(tcon, mode); /* Set dithering if needed */ - sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector); + if (tcon->panel) + sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector); /* Adjust clock delay */ clk_delay = sun4i_tcon_get_clk_delay(mode, 0); -- 2.17.1