[CRIU] [PATCH] criu: lazy-pages: take care of possible NULL pointer dereference

Andrew Vagin avagin at virtuozzo.com
Wed Jun 15 22:43:24 PDT 2016


On Thu, Jun 16, 2016 at 08:06:48AM +0300, Mike Rapoport wrote:
> Fix CID 163485 (#2 of 2): Dereference null return value (NULL_RETURNS)
> 7. dereference: Dereferencing a pointer that might be null dest when
> calling handle_user_fault.
> 
> Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
> ---
>  criu/uffd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/criu/uffd.c b/criu/uffd.c
> index 61100b8..988e311 100644
> --- a/criu/uffd.c
> +++ b/criu/uffd.c
> @@ -730,6 +730,7 @@ static int handle_requests(int epollfd, struct epoll_event *events)
>  
>  		for (i = 0; i < ret; i++) {
>  			lpi = uffd_to_lpi(events[i].data.fd);
> +			BUG_ON(!lpi);
>  			ret = handle_user_fault(lpi, dest);

offtopic: ret is used in the for expression, so you can't overwrite it
here.
>  			if (ret < 0)
>  				goto out;
> -- 
> 1.9.1
> 


More information about the CRIU mailing list