On 11.07.2025 03:07, dm...@proton.me wrote:
> On Thu, Jul 10, 2025 at 01:16:24PM +0200, Jan Beulich wrote:
>> On 10.07.2025 03:35, dm...@proton.me wrote:
>>> @@ -877,6 +873,16 @@ struct domain *domain_create(domid_t domid,
>>>
>>>      /* All error paths can depend on the above setup. */
>>>
>>> +    BUILD_BUG_ON(DOMAIN_CONSOLE_BUF_SIZE <= 0);
>>
>> While the "equals 0" case can in principle happen, the "less than" part
>> is dead code (and hence this needs checking differently): The type of
>> DOMAIN_CONSOLE_BUF_SIZE is an unsigned one, so wrapping through 0 will
>> yield huge positive values.
>>
>>> +    err = -ENOMEM;
>>> +    d->console = xzalloc_bytes(DOMAIN_CONSOLE_SIZE);
>>
>> As previously indicated, new code ought to use the xv*alloc family of
>> functions, which deliberately doesn't include any ..._bytes() forms.
>> Note how instead there is xvzalloc_flex_struct() for situations like
>> the one here.
> 
> Looks like xvzalloc_flex_struct() is not used anywhere in the code base...

And what do you mean to tell me by that? xvmalloc_flex_struct() is used,
and x[mz]alloc_flex_struct() uses are still in need of conversion (which
is going to be a slow-going process).

Jan

Reply via email to