From 5a72d1b3d38bfa2bb73786d56979fbe41ec603ce Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 3 Feb 2015 15:53:51 +1000 Subject: [PATCH] virglrenderer: test input to init function properly --- src/virglrenderer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/virglrenderer.c b/src/virglrenderer.c index ec44002..9753253 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -255,6 +255,12 @@ void virgl_renderer_poll(void) int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks *cbs) { + if (!cookie || !cbs) + return -1; + + if (cbs->version != 1) + return -1; + dev_cookie = cookie; rcbs = cbs; @@ -265,8 +271,6 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks use_egl_context = 1; } - if (cbs->version != 1) - return -1; vrend_renderer_init(&virgl_cbs); return 0; }