From: Giulio Benetti <giulio.benetti@micronovasrl.com> To: Maxime Ripard <maxime.ripard@bootlin.com> Cc: David Airlie <airlied@linux.ie>, Chen-Yu Tsai <wens@csie.org>, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Giulio Benetti <giulio.benetti@micronovasrl.com> Subject: [PATCH v3 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if NULL Date: Fri, 5 Oct 2018 23:59:51 +0200 [thread overview] Message-ID: <20181005215951.99003-2-giulio.benetti@micronovasrl.com> (raw) In-Reply-To: <20181005215951.99003-1-giulio.benetti@micronovasrl.com> If tcon->panel pointer is NULL, trying to dereference from it (i.e. tcon->panel->connector) will cause a null pointer dereference. Add tcon->panel null pointer check before calling sun4i_tcon0_mode_set_dithering(). Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Fixes: f11adcecbd5f ("drm/sun4i: tcon: Add dithering support for RGB565/RGB666 LCD panels") Reviewed-by: Chen-Yu Tsai <wens@csie.org> --- Changes V1->V2: * None Changes V2->V3: * Rewrite commit log 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
WARNING: multiple messages have this Message-ID (diff)
From: giulio.benetti@micronovasrl.com (Giulio Benetti) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if NULL Date: Fri, 5 Oct 2018 23:59:51 +0200 [thread overview] Message-ID: <20181005215951.99003-2-giulio.benetti@micronovasrl.com> (raw) In-Reply-To: <20181005215951.99003-1-giulio.benetti@micronovasrl.com> If tcon->panel pointer is NULL, trying to dereference from it (i.e. tcon->panel->connector) will cause a null pointer dereference. Add tcon->panel null pointer check before calling sun4i_tcon0_mode_set_dithering(). Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Fixes: f11adcecbd5f ("drm/sun4i: tcon: Add dithering support for RGB565/RGB666 LCD panels") Reviewed-by: Chen-Yu Tsai <wens@csie.org> --- Changes V1->V2: * None Changes V2->V3: * Rewrite commit log 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
next prev parent reply other threads:[~2018-10-05 22:00 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-10-01 9:36 [bug report] drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE checking if panel is used Dan Carpenter 2018-10-02 13:26 ` Giulio Benetti 2018-10-02 14:12 ` Giulio Benetti 2018-10-02 20:40 ` Giulio Benetti 2018-10-11 7:16 ` Dan Carpenter 2018-10-11 21:36 ` Giulio Benetti 2018-10-02 20:48 ` [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti 2018-10-02 20:48 ` Giulio Benetti 2018-10-02 20:49 ` [PATCH 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Giulio Benetti 2018-10-02 20:49 ` Giulio Benetti 2018-10-02 21:59 ` [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti 2018-10-02 21:59 ` Giulio Benetti 2018-10-02 21:59 ` Giulio Benetti 2018-10-02 21:59 ` [PATCH 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Giulio Benetti 2018-10-02 21:59 ` Giulio Benetti 2018-10-03 7:34 ` Chen-Yu Tsai 2018-10-03 7:34 ` Chen-Yu Tsai 2018-10-02 22:00 ` [PATCH 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti 2018-10-02 22:00 ` Giulio Benetti 2018-10-02 22:00 ` Giulio Benetti 2018-10-03 9:43 ` Chen-Yu Tsai 2018-10-03 9:43 ` Chen-Yu Tsai 2018-10-03 12:13 ` Giulio Benetti 2018-10-03 12:13 ` Giulio Benetti 2018-10-03 14:24 ` [PATCH v2 " Giulio Benetti 2018-10-03 14:24 ` Giulio Benetti 2018-10-03 14:24 ` [PATCH v2 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if null Giulio Benetti 2018-10-03 14:24 ` Giulio Benetti 2018-10-03 14:24 ` Giulio Benetti 2018-10-04 19:56 ` Maxime Ripard 2018-10-04 19:56 ` Maxime Ripard 2018-10-04 19:56 ` Maxime Ripard 2018-10-05 21:38 ` Giulio Benetti 2018-10-05 21:38 ` Giulio Benetti 2018-10-05 21:59 ` [PATCH v3 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Giulio Benetti 2018-10-05 21:59 ` Giulio Benetti 2018-10-05 21:59 ` Giulio Benetti 2018-10-05 21:59 ` Giulio Benetti [this message] 2018-10-05 21:59 ` [PATCH v3 2/2] drm/sun4i: tcon: prevent tcon->panel dereference if NULL Giulio Benetti 2018-10-08 9:21 ` Maxime Ripard 2018-10-08 9:21 ` Maxime Ripard 2018-10-12 10:03 ` Chen-Yu Tsai 2018-10-12 10:03 ` Chen-Yu Tsai 2018-11-05 13:23 ` Icenowy Zheng 2018-11-05 13:23 ` Icenowy Zheng 2018-11-06 15:57 ` Maxime Ripard 2018-11-06 15:57 ` Maxime Ripard 2018-10-04 19:54 ` [PATCH v2 1/2] drm/sun4i: tcon: fix check of tcon->panel null pointer Maxime Ripard 2018-10-04 19:54 ` Maxime Ripard 2018-10-04 19:54 ` Maxime Ripard
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20181005215951.99003-2-giulio.benetti@micronovasrl.com \ --to=giulio.benetti@micronovasrl.com \ --cc=airlied@linux.ie \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=maxime.ripard@bootlin.com \ --cc=wens@csie.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.