Skip to contentSkip to conversation

drm: Silence the compiler for drm_mode_get_hv_timings()

PATCH In review Chris Wilson 4 participants 5 messages Jan 26, 2017

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

PATCH 1/1 drm: Silence the compiler for drm_mode_get_hv_timings()

Since moving drm_crtc_get_hv_timings() into drm_modes.c, the compiler has been able to get smarter and spots that drm_mode_copy() is trying to preserve garbage from the stack.

Fixes 196cd5d3758c ("drm: s/drm_crtc_get_hv_timings/drm_mode_get_hv_timings/")
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/drm_modes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +1 -2
index 73ed6399c3fb..a8616b1a8d22 100644
@@ -808,9 +808,8 @@ EXPORT_SYMBOL(drm_mode_vrefresh);
 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
 			    int *hdisplay, int *vdisplay)
 {
-	struct drm_display_mode adjusted;
+	struct drm_display_mode adjusted = *mode;
 
-	drm_mode_copy(&adjusted, mode);
 	drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
 	*hdisplay = adjusted.crtc_hdisplay;
 	*vdisplay = adjusted.crtc_vdisplay;
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Chris Wilson

Since moving drm_crtc_get_hv_timings() into drm_modes.c, the compiler has been able to get smarter and spots that drm_mode_copy() is trying to preserve garbage from the stack.

Fixes 196cd5d3758c ("drm: s/drm_crtc_get_hv_timings/drm_mode_get_hv_timings/")
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Quoted 26 lines
---
 drivers/gpu/drm/drm_modes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +1 -2
index 73ed6399c3fb..a8616b1a8d22 100644
@@ -808,9 +808,8 @@ EXPORT_SYMBOL(drm_mode_vrefresh);
 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
 			    int *hdisplay, int *vdisplay)
 {
-	struct drm_display_mode adjusted;
+	struct drm_display_mode adjusted = *mode;
 
-	drm_mode_copy(&adjusted, mode);
 	drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
 	*hdisplay = adjusted.crtc_hdisplay;
 	*vdisplay = adjusted.crtc_vdisplay;
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 11 lines · Ville Syrjälä
Quoted 8 lines · Chris Wilson

Since moving drm_crtc_get_hv_timings() into drm_modes.c, the compiler has been able to get smarter and spots that drm_mode_copy() is trying to preserve garbage from the stack.

Fixes 196cd5d3758c ("drm: s/drm_crtc_get_hv_timings/drm_mode_get_hv_timings/")
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>

Could have directly pushed to drm-misc-next ... *hint*

Thanks for patch&review, applied.
-Daniel

Quoted 35 lines
Quoted 27 lines
---
 drivers/gpu/drm/drm_modes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +1 -2
index 73ed6399c3fb..a8616b1a8d22 100644
@@ -808,9 +808,8 @@ EXPORT_SYMBOL(drm_mode_vrefresh);
 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
 			    int *hdisplay, int *vdisplay)
 {
-	struct drm_display_mode adjusted;
+	struct drm_display_mode adjusted = *mode;
 
-	drm_mode_copy(&adjusted, mode);
 	drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
 	*hdisplay = adjusted.crtc_hdisplay;
 	*vdisplay = adjusted.crtc_vdisplay;
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjälä
Quoted 4 lines · Chris Wilson

Since moving drm_crtc_get_hv_timings() into drm_modes.c, the compiler has been able to get smarter and spots that drm_mode_copy() is trying to preserve garbage from the stack.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Fixes 196cd5d3758c ("drm: s/drm_crtc_get_hv_timings/drm_mode_get_hv_timings/")
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>

Could have directly pushed to drm-misc-next ... *hint*

That would miss the chance for some good bikeshedding ;)

Quoted 44 lines

Thanks for patch&review, applied.
-Daniel

Quoted 35 lines
Quoted 27 lines
---
 drivers/gpu/drm/drm_modes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +1 -2
index 73ed6399c3fb..a8616b1a8d22 100644
@@ -808,9 +808,8 @@ EXPORT_SYMBOL(drm_mode_vrefresh);
 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
 			    int *hdisplay, int *vdisplay)
 {
-	struct drm_display_mode adjusted;
+	struct drm_display_mode adjusted = *mode;
 
-	drm_mode_copy(&adjusted, mode);
 	drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
 	*hdisplay = adjusted.crtc_hdisplay;
 	*vdisplay = adjusted.crtc_vdisplay;
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#4 lore raw
In reply to Chris Wilson
Quoted 12 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]] On Behalf Of Chris Wilson
Sent: Thursday, January 26, 2017 6:44 AM
To: [email protected]
Cc: Chris Wilson; Daniel Vetter; Deucher, Alexander
Subject: [PATCH] drm: Silence the compiler for drm_mode_get_hv_timings()

Since moving drm_crtc_get_hv_timings() into drm_modes.c, the compiler has been able to get smarter and spots that drm_mode_copy() is trying to preserve garbage from the stack.

Quoted 5 lines
Fixes 196cd5d3758c ("drm:

s/drm_crtc_get_hv_timings/drm_mode_get_hv_timings/")

Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Quoted 20 lines
---
 drivers/gpu/drm/drm_modes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_modes.c +1 -3
index 73ed6399c3fb..a8616b1a8d22 100644
@@ -808,9 +808,8 @@ EXPORT_SYMBOL(drm_mode_vrefresh);
 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
 			    int *hdisplay, int *vdisplay)
 {
-	struct drm_display_mode adjusted;
+	struct drm_display_mode adjusted = *mode;
 
-	drm_mode_copy(&adjusted, mode);
 	drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE_ONLY);
 	*hdisplay = adjusted.crtc_hdisplay;
 	*vdisplay = adjusted.crtc_vdisplay;
--
Quoted 1 line

2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel