From b4d90b1182acb3365789755a618ef14cc7e53fa6 Mon Sep 17 00:00:00 2001 From: Eleni Maria Stea Date: Thu, 10 Jun 2021 14:09:02 +0300 Subject: [PATCH] egl: fix in expected type Function mincore expects a pointer of type char* but we use an unsigned char* instead generating signedness related warnings. v2: Made the fix FreeBSD specific because the type is unsigned char* for Linux and char* for FreeBSD. (Adam Jackson) v3: We'd rather cast the param to (void*) to avoid warnings in all systems (Adam Jackson) Signed-off-by: Eleni Maria Stea Part-of: --- src/egl/main/eglglobals.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index dd2b07c0da4..e0e9044a924 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -147,7 +147,10 @@ _eglPointerIsDereferencable(void *p) /* align addr to page_size */ addr &= ~(page_size - 1); - if (mincore((void *) addr, page_size, &valid) < 0) { + /* mincore expects &valid to be unsigned char* on Linux but char* on BSD: + * we cast pointers to void, to fix type mismatch warnings in all systems + */ + if (mincore((void *) addr, page_size, (void*)&valid) < 0) { return EGL_FALSE; }