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

Andrew Vagin avagin at parallels.com
Fri Nov 28 00:20:59 PST 2014


On Fri, Nov 28, 2014 at 11:07:25AM +0300, Pavel Emelyanov wrote:
> 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.

Yes, you are right. But now when we are splicing memory, we know nothing
about parent. We will get this information, when we will dump this pages
in images.

Should we open images before splicing memory? It will increase freeze
time.

> 
> > 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