diff mbox

drm/mst: Don't use uninitialized fields of the sideband message header

Message ID 1405336398-26660-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien July 14, 2014, 11:13 a.m. UTC
We could be using uninitialized fields of the header in
drm_dp_encode_sideband_msg_hdr(), for instance hdr->somt is set to 1 in
the first patcket but never set to 0 otherwise.

Always clear the header at the start then.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel Vetter July 15, 2014, 7:40 a.m. UTC | #1
On Mon, Jul 14, 2014 at 12:13:18PM +0100, Damien Lespiau wrote:
> We could be using uninitialized fields of the header in
> drm_dp_encode_sideband_msg_hdr(), for instance hdr->somt is set to 1 in
> the first patcket but never set to 0 otherwise.
> 
> Always clear the header at the start then.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

Both pulled into topic/core-stuff with the summary tag bikeshedded to
drm/dp-helper.
-Daniel

> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 813b8d1..618526d 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1290,6 +1290,8 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
>  	int len, space, idx, tosend;
>  	int ret;
>  
> +	memset(&hdr, 0, sizeof(struct drm_dp_sideband_msg_hdr));
> +
>  	if (txmsg->state == DRM_DP_SIDEBAND_TX_QUEUED) {
>  		txmsg->seqno = -1;
>  		txmsg->state = DRM_DP_SIDEBAND_TX_START_SEND;
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 813b8d1..618526d 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1290,6 +1290,8 @@  static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	int len, space, idx, tosend;
 	int ret;
 
+	memset(&hdr, 0, sizeof(struct drm_dp_sideband_msg_hdr));
+
 	if (txmsg->state == DRM_DP_SIDEBAND_TX_QUEUED) {
 		txmsg->seqno = -1;
 		txmsg->state = DRM_DP_SIDEBAND_TX_START_SEND;