Re: [PATCH net] ice: Fix freeing uninitialized pointers

From: Markus Elfring
Date: Thu Mar 21 2024 - 14:20:15 EST


>> How do you think about to reduce the scope for the affected local variable instead
>> with the help of a small script (like the following) for the semantic patch language?
>>
>> @movement@
>> attribute name __free;
>> @@
>> -u8 *tx_frame __free(kfree);
>> int i;
>> ... when any
>> if (ice_fltr_add_mac(test_vsi, ...))
>> { ... }
>> +
>> +{
>> +u8 *tx_frame __free(kfree) = NULL;
>> if (ice_lbtest_create_frame(pf, &tx_frame, ...))
>> { ... }
>> ... when any
>> +}
>> +
>> valid_frames = ice_lbtest_receive_frames(...);
>
> I believe you don't understand what the scope of the above can be.

Will the understanding improve for the proposed source code transformation?

Regards,
Markus