[PATCH weston 7/9] compositor-drm: fix uninitialized bytes on modeinfo

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 9 13:07:25 UTC 2018


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Fixes the following Valgrind error:

==21607== Syscall param ioctl(generic) points to uninitialised byte(s)
==21607==    at 0x5E8C787: ioctl (in /lib64/libc-2.25.so)
==21607==    by 0x8220C17: drmIoctl (in /usr/lib64/libdrm.so.2.4.0)
==21607==    by 0x82263CD: drmModeSetCrtc (in /usr/lib64/libdrm.so.2.4.0)
==21607==    by 0x7B22095: drm_output_apply_state_legacy (compositor-drm.c:2107)
==21607==    by 0x7B2335D: drm_pending_state_apply (compositor-drm.c:2539)
==21607==    by 0x7B23AEB: drm_repaint_flush (compositor-drm.c:2773)
==21607==    by 0x4E4A3E4: output_repaint_timer_handler (compositor.c:2500)
==21607==    by 0x5081496: wl_event_source_timer_dispatch (event-loop.c:235)
==21607==    by 0x5081B61: wl_event_loop_dispatch (event-loop.c:633)
==21607==    by 0x50803A4: wl_display_run (wayland-server.c:1245)
==21607==    by 0x409DD8: main (main.c:2644)
==21607==  Address 0xffefff59a is on thread 1's stack
==21607==  in frame #2, created by drmModeSetCrtc (???:)
==21607==  Uninitialised value was created by a stack allocation
==21607==    at 0x7B2782F: drm_output_choose_initial_mode (compositor-drm.c:4842)

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 libweston/compositor-drm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 1897f455..a975b379 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4347,6 +4347,8 @@ parse_modeline(const char *s, drmModeModeInfo *mode)
 	char vsync[16];
 	float fclock;
 
+	*mode = (drmModeModeInfo){};
+
 	mode->type = DRM_MODE_TYPE_USERDEF;
 	mode->hskew = 0;
 	mode->vscan = 0;
-- 
2.13.6



More information about the wayland-devel mailing list