compositor-drm: fix uninitialized bytes on modeinfo

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@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
[Pekka: switch to memset]
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Pekka Paalanen 7 years ago
parent dc14fd4cd7
commit dc4e3c6118
  1. 2
      libweston/compositor-drm.c

@ -4347,6 +4347,8 @@ parse_modeline(const char *s, drmModeModeInfo *mode)
char vsync[16];
float fclock;
memset(mode, 0, sizeof *mode);
mode->type = DRM_MODE_TYPE_USERDEF;
mode->hskew = 0;
mode->vscan = 0;

Loading…
Cancel
Save