From 82b8ddf9d9640b23237a1799b2912641082ad2d1 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 13 Sep 2017 11:58:00 +0300 Subject: [PATCH] compositor-fbdev: MAP_FAILED is not NULL Fix the assumption that MAP_FAILED would be equal to NULL. It is not. Set 'fb' explicitly to NULL on mmap failure so that comparisons to NULL would produce the expected result. Signed-off-by: Pekka Paalanen Reviewed-by: Daniel Stone --- libweston/compositor-fbdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c index 6a305385..b1cc5dca 100644 --- a/libweston/compositor-fbdev.c +++ b/libweston/compositor-fbdev.c @@ -383,6 +383,7 @@ fbdev_frame_buffer_map(struct fbdev_output *output, int fd) if (output->fb == MAP_FAILED) { weston_log("Failed to mmap frame buffer: %s\n", strerror(errno)); + output->fb = NULL; goto out_close; }