[PATCH] compositor-drm: pass NULL to mmap() instead of 0 as the address

Derek Foreman derekf at osg.samsung.com
Thu Nov 12 08:32:07 PST 2015


On 10/11/15 09:40 AM, Chris Michael wrote:
> mmap() function expects to be passed a void pointer as the address
> here. In order for the kernel to choose a proper address, we should be
> passing NULL instead of 0

Don't like this text because I think it accidentally implies the kernel
will choose a different address when passed 0 than when passed NULL.

I've slightly shortened the commit log to remove that bit when pushing. :)

Reviewed-by: Derek Foreman <derekf at osg.samsung.com>

Thanks,
Derek

> Signed-off-by: Chris Michael <cp.michael at samsung.com>
> ---
>  src/compositor-drm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index a279dba..a84d869 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -308,7 +308,7 @@ drm_fb_create_dumb(struct drm_backend *b, unsigned width, unsigned height)
>  	if (ret)
>  		goto err_add_fb;
>  
> -	fb->map = mmap(0, fb->size, PROT_WRITE,
> +	fb->map = mmap(NULL, fb->size, PROT_WRITE,
>  		       MAP_SHARED, b->drm.fd, map_arg.offset);
>  	if (fb->map == MAP_FAILED)
>  		goto err_add_fb;
> 



More information about the wayland-devel mailing list