[PATCH 2/5] rtems-fdt.c: Fix Resource leak (CID #1437645)

Chris Johns chrisj at rtems.org
Tue Mar 16 18:34:53 UTC 2021


On 17/3/21 2:14 am, Gedare Bloom wrote:
> On Tue, Mar 16, 2021 at 1:15 AM Niteesh G. S. <niteesh.gs at gmail.com> wrote:
>> On Tue, 16 Mar 2021, 1:37 am Gedare Bloom, <gedare at rtems.org> wrote:
>>>
>>> This one looks ok to me, Niteesh?
>>
>> +1
>>
>> The below question is not related to this patch.
>>
>> Out of interest, I started going through the code  and I am a bit confused in the following statement
>>
>> https://git.rtems.org/rtems/tree/cpukit/libmisc/rtems-fdt/rtems-fdt.c#n574
>>
>> This else block is reached when the FDT blob is not compressed, in this case the size variable is set to the file size since this is raw data.
>>
>> In the while loop, we are looping on size, but we never modify the size. I think, line 583 should be
>>                     size -= r;
>> Instead of
>>                     r -= size;
>> Is this a bug??
>> Or am I missing something?
>>
> 
> it looks weird to me too. Chris?
> 

That is a bug. Nice find.

The use case for this call has an FPGA bitfile and the compressed FDT file in a
single package.

Thanks
Chris



More information about the devel mailing list