Skip to contentSkip to conversation

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

PATCH In review Damien Lespiau 2 participants 2 messages Jul 14, 2014 – Jul 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
index 813b8d1..618526d 100644
@@ -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;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 7 lines · Damien Lespiau

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.

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

Quoted 24 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
index 813b8d1..618526d 100644
@@ -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;
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch