summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2017-04-20 15:57:33 +1000
committerBen Skeggs <bskeggs@redhat.com>2017-04-20 16:05:25 +1000
commit3047e99a641d2b8720371aae292750206f5e91fc (patch)
tree6944daa8695c66004bcc5371747a5c8368751f9b
parente9418e434311336e905b70553a5ed740838d90ad (diff)
fix null pointer deref when building against >=libdrm 2.4.78
A new pointer got added to drmEventContext. As a result of us both: - Setting drmEventContext.version to "latest" AND - Not zeroing the struct We end up thwarting libdrm's compatibility checks, resulting in libdrm choosing to call through an invalid pointer. Fix this by zeroing the struct. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--src/drmmode_display.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ae29d9a..2b71c9c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1433,7 +1433,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
unsigned int crtcs_needed = 0;
int crtcshift;
- drmmode = xnfalloc(sizeof *drmmode);
+ drmmode = xnfcalloc(sizeof(*drmmode), 1);
drmmode->fd = fd;
drmmode->fb_id = 0;