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

Re: [libvirt] [PATCH] security: plug regression introduced in disk probe logic



On 06/01/2011 04:52 PM, Matthias Bolte wrote:
>>> +++ b/src/security/security_manager.c
>>> @@ -107,7 +107,7 @@ virSecurityManagerPtr virSecurityManagerNew(const char *name,
>>>
>>>  void *virSecurityManagerGetPrivateData(virSecurityManagerPtr mgr)
>>>  {
>>> -    return ((char*)mgr) + sizeof(mgr);
>>> +    return ((char*)mgr) + sizeof(*mgr);
>>
>> I suppose I could have used:
>>
>> return mgr + 1;
>>
>> instead, since that gives the same address with less typing.  Any
>> preferences on which form to commit?
>>
> 
> I'd say go with the more readable mgr + 1.

Thanks, and pushed as follows:

 void *virSecurityManagerGetPrivateData(virSecurityManagerPtr mgr)
 {
-    return ((char*)mgr) + sizeof(mgr);
+    /* This accesses the memory just beyond mgr, which was allocated
+     * via VIR_ALLOC_VAR earlier.  */
+    return mgr + 1;
 }

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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