From: Ian Campbell Date: Wed, 10 Feb 2016 16:26:25 +0000 (+0000) Subject: xenmon: initialise dummy array X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1776 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8b00908c114b0546e12cd1a0076b5af622c6bc08;p=xen.git xenmon: initialise dummy array This is just used to expand the shared backing file to the expected size (whether this is actually necessary I'm not sure). Rather than leaking some small amount of the processes' heap set the array to zeroes. While at it add a check that the malloc succeeded before using the result. Compile tested only. CID: 1056095 (use of uninitialised data) Signed-off-by: Ian Campbell Acked-by: Wei Liu --- diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c index 782f0c1fd1..3d9e0ed900 100644 --- a/tools/xenmon/xenbaked.c +++ b/tools/xenmon/xenbaked.c @@ -663,6 +663,11 @@ static void alloc_qos_data(int ncpu) } pgsize = getpagesize(); dummy = malloc(pgsize); + if (!dummy) { + PERROR("malloc"); + exit(EXIT_FAILURE); + } + memset(dummy, 0, pgsize); for (n=0; n