drm/dsi: Do the 'msg' check prior to dereferencing it.
Subsystems (2)
PATCH 1/1 drm/dsi: Do the 'msg' check prior to dereferencing it.
From: Fabio Estevam <[email protected]>
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.
--- drivers/gpu/drm/drm_mipi_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +3 -1
@@ -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))
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Commit
a52879e8d7cb("drm/dsi: Add message to packet translator") caused the following Smatch complaint:
drivers/gpu/drm/drm_mipi_dsi.c:328mipi_dsi_create_packet()
warn: variable dereferenced before check 'msg' (see line 326)
Quoted 7 lines
Do the 'msg' check prior to dereferencing it.
Reported-by Dan Carpenter <[email protected]>Signed-off-by Fabio Estevam <[email protected]>--- drivers/gpu/drm/drm_mipi_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
I've had an equivalent patch in the drm/panel tree for almost two weeks but had forgotten to push. Pushed now.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel