All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]  drm/dsi: Do the 'msg' check prior to dereferencing it.
@ 2014-12-17  0:04 Fabio Estevam
  2014-12-17 10:59 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2014-12-17  0:04 UTC (permalink / raw)
  To: airlied; +Cc: Fabio Estevam, treding, dan.carpenter, dri-devel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-17 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17  0:04 [PATCH] drm/dsi: Do the 'msg' check prior to dereferencing it Fabio Estevam
2014-12-17 10:59 ` Thierry Reding

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.