Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1774114imm; Tue, 2 Oct 2018 13:49:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV61W8p6OUBrGAyrx5UJya4twlxsy9jP2LBy1fUV6OgStqfqkhIx418JlDYaaYdSUi1gKXo5k X-Received: by 2002:a17:902:bd06:: with SMTP id p6-v6mr18181786pls.226.1538513371530; Tue, 02 Oct 2018 13:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538513371; cv=none; d=google.com; s=arc-20160816; b=LGQC3GEm0QE4dmhIkU41P8Fw2yR71NAXqDEklTwTYwWVqL/9Go/aPkbOrQHz2ruFlj b+W8k9YdtV5IqXseBV7Y9h4WFHX0S78bJ5TWxgsunpMwXYQAW9zNDov1UYr+mcP7KRQx wUsQSMveStRo0QDaUAsgsR1hf6Jr4xiN8fWFbFOGCrhZssnORnx7Zcohfa0V7p4FTj8o FawZndzJx0iMGA/XKKvMImZcamvTsMEFpzYSejzxklAtIBHnNIh3DSolW8sYHg4XhZ1P m9G8hasqU8zApwqn0uGybI482/f4QUeo95r4yK5MksQ6T8T5vFS9qMmOJjQkg1ePGl3A ba4A== 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=3xx56aYYFHl7443plE1wqQFfT6qYVs3QMVUjvian6rE=; b=jesAnjtGSRMZ/FLu3y+kroaXoxTrxlbJovw/6sOR5TYuCNOx04MmGHr9WDLpuAVOhR Fqm1wlZUlz9CSALdEW02+WGCdUgCE+i3/3JhBdv8heEUYc493toAJkWVdY3iIh+P5pnX XYUNGIkXsAuuelAmSd4h8aeN/a9mhYIPpr5hFI6kky5fz3SIsORcyWS/SUDcy432SfV9 N8YlQTqC4q1k7sUu4W+fAQAJ7rqaBcr97dOVU6GkAy/v6YruOXCWwM8gleLBaXDLEKka 3Mh4TQkr4I1XyFwjybrOXbYaxgpTljxFq4SGGwqSSy5kHLSW89cQVzTJstO9+1lNEdNp 7pBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=OR0cTZsa; 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 u1-v6si12265318pgh.244.2018.10.02.13.49.15; Tue, 02 Oct 2018 13:49:31 -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=OR0cTZsa; 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 S1727658AbeJCDeT (ORCPT + 99 others); Tue, 2 Oct 2018 23:34:19 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:36366 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbeJCDeS (ORCPT ); Tue, 2 Oct 2018 23:34:18 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 5DE3FB01096 for ; Tue, 2 Oct 2018 22:49:05 +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=1538513344; x=1539377345; bh=4F HVT5NrrG/QTe2Mj+ppLwr5ncrmz/fzttP4uUPdogc=; b=OR0cTZsaaqYPhNkaD6 t4dxK5VRaiw36+zWBIJ13myKdAeqm47677uMJv2wzeV+KUKNRjuTPZYXXFusOLz0 Ns4T/Ar88DvxooPvqtMaL+GEKrsvECXpVcDZt51GKG0MLDtluCrpFIRxH0iG1eWX QUmA7tkC3rld8EVMOUol5trcw= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] 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 ciLECyTynNFE for ; Tue, 2 Oct 2018 22:49:04 +0200 (CEST) Received: from ubuntu.localdomain (146-241-101-147.dyn.eolo.it [146.241.101.147]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 60BAAB00BA1; Tue, 2 Oct 2018 22:49:03 +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, Dan Carpenter , Giulio Benetti Subject: [PATCH 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Date: Tue, 2 Oct 2018 22:49:00 +0200 Message-Id: <20181002204900.82118-2-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181002204900.82118-1-giulio.benetti@micronovasrl.com> References: <20181001093612.GA13672@mwanda> <20181002204900.82118-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 --- 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