dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [GIT PULL] drm/panel: Changes for v3.20-rc1
Date: Mon, 26 Jan 2015 10:53:44 +0100	[thread overview]
Message-ID: <20150126095343.GA3508@ulmo> (raw)
In-Reply-To: <87a915hpuf.fsf@intel.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 542 bytes --]

On Mon, Jan 26, 2015 at 11:07:52AM +0200, Jani Nikula wrote:
> On Fri, 23 Jan 2015, Thierry Reding <thierry.reding@gmail.com> wrote:
> > Thierry Reding (4):
> >       drm/mipi-dsi: Avoid potential NULL pointer dereference
> 
> I can't find this one, has it been posted on the list?

I thought it had, but I can't find any record of that. It certainly was
reported on-list:

	Subject: re: drm/dsi: Add message to packet translator
	Message-ID: <20141216235305.GC31467@mwanda>

I've attached the patch for convenience.

Thierry

[-- Attachment #1.1.2: 0001-drm-mipi-dsi-Avoid-potential-NULL-pointer-dereferenc.patch --]
[-- Type: text/x-diff, Size: 1505 bytes --]

From 903c75cb0da218e3849fff3c2c17a9f2ab5705ba Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Fri, 5 Dec 2014 11:46:56 +0100
Subject: [PATCH] drm/mipi-dsi: Avoid potential NULL pointer dereference

The mipi_dsi_packet_create() function dereferences the msg pointer
before checking that it's valid. Move the dereference down to where it
is required to avoid potentially dereferencing a NULL pointer.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/drm_mipi_dsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index c0644bb865f2..2d5ca8eec13a 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -323,8 +323,6 @@ EXPORT_SYMBOL(mipi_dsi_packet_format_is_long);
 int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
 			   const struct mipi_dsi_msg *msg)
 {
-	const u8 *tx = msg->tx_buf;
-
 	if (!packet || !msg)
 		return -EINVAL;
 
@@ -353,8 +351,10 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
 		packet->header[2] = (msg->tx_len >> 8) & 0xff;
 
 		packet->payload_length = msg->tx_len;
-		packet->payload = tx;
+		packet->payload = msg->tx_buf;
 	} else {
+		const u8 *tx = msg->tx_buf;
+
 		packet->header[1] = (msg->tx_len > 0) ? tx[0] : 0;
 		packet->header[2] = (msg->tx_len > 1) ? tx[1] : 0;
 	}
-- 
2.1.3


[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-01-26  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 13:56 [GIT PULL] drm/panel: Changes for v3.20-rc1 Thierry Reding
2015-01-26  9:07 ` Jani Nikula
2015-01-26  9:53   ` Thierry Reding [this message]
2015-01-26 10:28     ` Jani Nikula
  -- strict thread matches above, loose matches on Subject: below --
2015-01-28  9:04 Thierry Reding

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=20150126095343.GA3508@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox