[libvirt] [PATCH] qemuTestDriverInit: fill driver with zeroes

Michal Privoznik mprivozn at redhat.com
Mon Jan 18 10:29:17 UTC 2016


On 18.01.2016 10:22, Jiri Denemark wrote:
> On Mon, Jan 18, 2016 at 09:23:58 +0100, Michal Privoznik wrote:
>> In the commit aea47e48c473a we have fixed a single pointer within
>> driver structure. Since all callers pass statically allocated
>> driver on stack other pointers within driver may contain random
>> values too. Before touching it lets overwrite it with zeroes and
>> thus fix all dangling pointers.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  tests/testutilsqemu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
>> index f2eacdd..6c52b96 100644
>> --- a/tests/testutilsqemu.c
>> +++ b/tests/testutilsqemu.c
>> @@ -558,7 +558,7 @@ int qemuTestDriverInit(virQEMUDriver *driver)
>>      if (virMutexInit(&driver->lock) < 0)
>>          return -1;
>>  
>> -    driver->securityManager = NULL;
>> +    memset(driver, 0, sizeof(*driver));
> 
> I'm afraid you just killed the just initialized mutex...
> 

Oh, you're right. Obviously I should not post any patches until morning
coffee has kicked in.

Michal




More information about the libvir-list mailing list