[libvirt] [PATCH] security: plug regression introduced in disk probe logic
Eric Blake
eblake at redhat.com
Wed Jun 1 23:07:09 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110601/1b402951/attachment-0001.sig>
More information about the libvir-list
mailing list