On Tue, 2016-02-02 at 12:37 +0000, Wei Liu wrote:
> On Tue, Feb 02, 2016 at 12:33:20PM +0100, Roger Pau Monne wrote:
> > From: Roger Pau Monne <roy...@freebsd.org>
> > 
> > Due to the HVMlite changes there's a chance that the value in rc is
> > checked
> > without being initialised. Fix this by initialising it to 0.
> > 
> > Signed-off-by: Roger Pau Monné <roger....@citrix.com>
> > Reported-by: Olaf Hering <o...@aepfle.de>
> 
> Acked-by: Wei Liu <wei.l...@citrix.com>

This is CID 1351229, I think?

** CID 1351229:  Uninitialized variables  (UNINIT)
> /tools/libxc/xc_dom_x86.c: 1443 in meminit_hvm()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 1351229:  Uninitialized variables  (UNINIT)
> /tools/libxc/xc_dom_x86.c: 1443 in meminit_hvm()
> 1437                 cur_pages = 0xc0;
> 1438                 stat_normal_pages += 0xc0;
> 1439             }
> 1440             else
> 1441                 cur_pages = vmemranges[vmemid].start >> PAGE_SHIFT;
> 1442     
> >>>     CID 1351229:  Uninitialized variables  (UNINIT)
> >>>     Using uninitialized value "rc".
> 1443             while ( (rc == 0) && (end_pages > cur_pages) )
> 1444             {
> 1445                 /* Clip count to maximum 1GB extent. */
> 1446                 unsigned long count = end_pages - cur_pages;
> 1447                 unsigned long max_pages = SUPERPAGE_1GB_NR_PFNS;
> 1448    

Note that this while loop ends with:
        if ( rc != 0 )
            break;
and there are no continue statements.

Therefore I wonder if we would be better off removing the rc == 0 part of
the loop condition?

The issue with this patch is the usual one that it will hide other
unintentional uses of rc before it is set to a good value.

This issue was exposed by a prior "rc = xc_domain_populate_physmap_exact"
becoming conditional on device_model. What is also concerning is the lack
of error checking on that call -- is it really ok to just barrel on under
these circumstance?

Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to