[CRIU] [PATCH 13/16] mem/shmem: Use xrealloc_safe in expand_shmem

Mike Rapoport rppt at linux.ibm.com
Mon Jul 8 20:07:39 MSK 2019


On Fri, Jul 05, 2019 at 06:38:08PM +0300, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>

Reviewed-by: Mike Rapoport <rppt at linux.ibm.com>

> ---
>  criu/shmem.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/criu/shmem.c b/criu/shmem.c
> index 03b088f268a9..da9242674291 100644
> --- a/criu/shmem.c
> +++ b/criu/shmem.c
> @@ -197,8 +197,7 @@ static int expand_shmem(struct shmem_info *si, unsigned long new_size)
>  
>  	BUG_ON(new_map_size < map_size);
>  
> -	si->pstate_map = xrealloc(si->pstate_map, new_map_size);
> -	if (!si->pstate_map)
> +	if (xrealloc_safe(&si->pstate_map, new_map_size))
>  		return -1;
>  	memzero(si->pstate_map + nr_map_items, new_map_size - map_size);
>  	return 0;
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> 

-- 
Sincerely yours,
Mike.



More information about the CRIU mailing list