[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] tools/libxl: Alter the use of rand() in testidl



On Fri, Aug 07, 2015 at 03:06:24PM +0100, Andrew Cooper wrote:
> Coverity warns for every occurrence of rand(), which is made worse
> because each time the IDL changes, some of the calls get re-flagged.
> 
> Collect all calls to rand() in a single function, test_rand(), which
> takes a modulo parameter for convenience.  This turns 40 defects
> currently into 1, which won't get re-flagged when the IDL changes.
> 
> In addition, fix the erroneous random choice for libxl_defbool_set().
> "!!rand() % 1" is unconditionally 0, and even without the "% 1" would
> still be very heavily skewed in one direction.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.