qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] xen: Don't peek behind the BlockDriverState


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 2/2] xen: Don't peek behind the BlockDriverState abstraction
Date: Wed, 13 Jun 2012 09:35:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Peter Maydell <address@hidden> writes:

> On 7 June 2012 09:13, Markus Armbruster <address@hidden> wrote:
>> Peter Maydell <address@hidden> writes:
>>> I think it matters in the general case, yours is just the first
>>> usage of this API which has caught my attention. We should fix
>>> the API before adding more uses of it (at the moment it seems to
>>> be only used in two places).
>>
>> What kind of fix do you have in mind?
>
> Option 1: the function should guarantee that it won't ever
> use more than X bytes of buffer, and provide a #define that
> corresponds to that maximum length.
>
> Option 2: this: vv
>
>>> Alternatively, we could have the function return a const char* rather
>>> than taking a buffer to be filled in.
>>
>> Trades the theoretical string truncation problem for a theoretical
>> dangling pointer problem.
>
> Yes, you'd need to come up with some reasonable lifecycle
> management if you took this option.

Actually, the lifecycle is trivial, because it's a *driver* name, and
drivers never go away.  Taking option 2.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]