[CRIU] [PATCH] mem: don't use an unitialized pointer

Pavel Emelyanov xemul at parallels.com
Fri Nov 28 00:07:25 PST 2014


On 11/28/2014 10:59 AM, Andrey Vagin wrote:
> When we are dumping pages on pre-dump, we know nothing about a parent
> images, so we need to splice all memory to pipes and then decide which
> should be dumped.

No, pre-dump can be done after another pre-dump, thus we should
not splice _all_ memory into pipes, but only the soft-dirty one.

> CID 83244 (#1 of 1): Uninitialized pointer read (UNINIT)
> 14. uninit_use: Using uninitialized value xfer.parent.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  mem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mem.c b/mem.c
> index 9aedf37..478e85e 100644
> --- a/mem.c
> +++ b/mem.c
> @@ -244,7 +244,7 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
>  	pmc_t pmc = PMC_INIT;
>  	struct page_pipe *pp;
>  	struct vma_area *vma_area;
> -	struct page_xfer xfer;
> +	struct page_xfer xfer = { .parent = NULL };
>  	int ret = -1;
>  
>  	pr_info("\n");
> 



More information about the CRIU mailing list