[PATCH 2/2] rtl-allocator.c: Put dereferences after nullcheck

Chris Johns chrisj at rtems.org
Wed Mar 31 04:42:23 UTC 2021


+1

... but it is blocked by the 1/2 patch until that is resolved or a v2 patch set
is created.

On 31/3/21 4:05 am, Gedare Bloom wrote:
> ok
> 
> On Tue, Mar 30, 2021 at 10:57 AM Ryan Long <ryan.long at oarcorp.com> wrote:
>>
>> ping
>>
>> -----Original Message-----
>> From: Ryan Long <ryan.long at oarcorp.com>
>> Sent: Monday, March 22, 2021 12:08 PM
>> To: devel at rtems.org
>> Cc: Ryan Long <ryan.long at oarcorp.com>
>> Subject: [PATCH 2/2] rtl-allocator.c: Put dereferences after nullcheck
>>
>> CID 1444139: Dereference null return value in rtems_rtl_alloc_hook().
>>
>> Closes #4333
>> ---
>>  cpukit/libdl/rtl-allocator.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/cpukit/libdl/rtl-allocator.c b/cpukit/libdl/rtl-allocator.c index 647c0c8..861754e 100644
>> --- a/cpukit/libdl/rtl-allocator.c
>> +++ b/cpukit/libdl/rtl-allocator.c
>> @@ -162,8 +162,11 @@ rtems_rtl_allocator  rtems_rtl_alloc_hook (rtems_rtl_allocator handler)  {
>>    rtems_rtl_data*     rtl = rtems_rtl_lock ();
>> -  rtems_rtl_allocator previous = rtl->allocator.allocator;
>> -  rtl->allocator.allocator = handler;
>> +  rtems_rtl_allocator previous = NULL;
>> +  if (rtl != NULL) {
>> +    previous = rtl->allocator.allocator;
>> +    rtl->allocator.allocator = handler;  }
>>    rtems_rtl_unlock ();
>>    return previous;
>>  }
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 


More information about the devel mailing list