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

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

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]