[CRIU] [PATCH] aio: Fix mmap retval analysing

Andrew Vagin avagin at virtuozzo.com
Fri May 13 13:44:15 PDT 2016


On Fri, May 13, 2016 at 01:45:36PM +0300, Kirill Tkhai wrote:
> MAP_FAILED is retval of lib'c mmap(). Direct syscall
> returns IS_ERR() in case of error.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/pie/restorer.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
> index c4fc1e5..9249b9d 100644
> --- a/criu/pie/restorer.c
> +++ b/criu/pie/restorer.c
> @@ -624,7 +624,7 @@ static int restore_aio_ring(struct rst_aio_ring *raio)
>  				MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
>  	iocbp = (void *)iocb + sizeof(struct iocb);
>  
> -	if (iocb == MAP_FAILED) {
> +	if (IS_ERR(iocb)) {
>  		pr_err("Can't mmap aio tmp buffer\n");

I think we need to print an error code
		pr_err("Can't mmap aio tmp buffer: %ld\n", PTR_ERR(iocbp));

>  		return -1;
>  	}
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list