Re: [PATCH v2 05/12] hw/cxl: fix invalid free on early return

Akihiko Odaki <[email protected]> Tue, 28 Jul 2026 15:45:58 +0900
Newsgroups org.kernel.vger.linux-cxl,org.nongnu.qemu-devel
Message-ID <[email protected]>
On 2026/07/27 17:30, Michael S. Tsirkin wrote:
> On Mon, Jul 27, 2026 at 01:40:48PM +0900, Akihiko Odaki wrote:
>> On 2026/07/27 6:09, Marc-André Lureau wrote:
>>> On Mon, Jul 27, 2026 at 12:49 AM Michael S. Tsirkin <[email protected]> wrote:
>>>>
>>>> On Mon, Jul 27, 2026 at 12:44:04AM +0400, Marc-André Lureau wrote:
>>>>> Fixes: 680935c9a6ff ("hw/cxl: Add a performant (and correct) path for the non interleaved cases")
>>>>> Signed-off-by: Marc-André Lureau <[email protected]>
>>>>
>>>> Not commit log really?
>>>
>>> SSIA, but I can make it longer if it helps.
>>
>> I agree the subject is sufficient so:
>>
>> Reviewed-by: Akihiko Odaki <[email protected]>
>>
>> That said, we can quote docs/devel/style.rst if desired:
>>
>>> * Variables declared with g_auto* MUST always be initialized,
>>>    otherwise the cleanup function will use uninitialized stack memory
> 
> I like that. But the question is not just whether it's required by
> the coding style. The question is if there's a bug and how is it
> reacheable, which can guide things like backporting decisions.
> Thanks!

The quoted text also tells the consequence. Probably it's placed in 
docs/devel/style.rst just because people are likely to check it.

Regards,
Akihiko Odaki

> 
>> Regards,
>> Akihiko Odaki
>>
>>>
>>>>
>>>>> ---
>>>>>    hw/cxl/cxl-host.c | 2 +-
>>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
>>>>> index 7e744312f1d8..eba13c9e7cba 100644
>>>>> --- a/hw/cxl/cxl-host.c
>>>>> +++ b/hw/cxl/cxl-host.c
>>>>> @@ -279,7 +279,7 @@ static void cxl_fmws_direct_passthrough_setup(CXLDirectPTState *state,
>>>>>        MemoryRegion *mr = NULL;
>>>>>        uint64_t vmr_size = 0, pmr_size = 0, offset = 0;
>>>>>        MemoryRegion *direct_mr;
>>>>> -    g_autofree char *direct_mr_name;
>>>>> +    g_autofree char *direct_mr_name = NULL;
>>>>>        unsigned int idx = state->hdm_decoder_idx;
>>>>>
>>>>>        if (ct3d->hostvmem) {
>>>>>
>>>>> --
>>>>> 2.55.0
>>>>
>>>>
>