All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: airlied@linux.ie
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	treding@nvidia.com, dan.carpenter@oracle.com,
	dri-devel@lists.freedesktop.org
Subject: [PATCH]  drm/dsi: Do the 'msg' check prior to dereferencing it.
Date: Tue, 16 Dec 2014 22:04:34 -0200	[thread overview]
Message-ID: <1418774674-14390-1-git-send-email-festevam@gmail.com> (raw)

From: Fabio Estevam <fabio.estevam@freescale.com>

Commit a52879e8d7cb ("drm/dsi: Add message to packet translator") caused the
following Smatch complaint:

drivers/gpu/drm/drm_mipi_dsi.c:328 mipi_dsi_create_packet()
         warn: variable dereferenced before check 'msg' (see line 326)

Do the 'msg' check prior to dereferencing it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com> 
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/gpu/drm/drm_mipi_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index c0644bb..a9812db 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -323,11 +323,13 @@ 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;
+	const u8 *tx;
 
 	if (!packet || !msg)
 		return -EINVAL;
 
+	tx = msg->tx_buf;
+
 	/* do some minimum sanity checking */
 	if (!mipi_dsi_packet_format_is_short(msg->type) &&
 	    !mipi_dsi_packet_format_is_long(msg->type))
-- 
1.9.1

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

             reply	other threads:[~2014-12-17  0:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17  0:04 Fabio Estevam [this message]
2014-12-17 10:59 ` [PATCH] drm/dsi: Do the 'msg' check prior to dereferencing it 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=1418774674-14390-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@freescale.com \
    --cc=treding@nvidia.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 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.