Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions source/lm/cosa_wantraffic_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,13 @@ VOID WTC_ApplyStateChange
}
else
{
//CID 560247 Data race condition (MISSING_LOCK)
pthread_mutex_lock(&WTCinfo->WanTrafficMutexVar);
if(WanTrafficCountInfo_t[index]->ThreadStatus == WTC_THRD_DISMISSED)
{
WTC_RbusUnsubscribe(index);
}
pthread_mutex_unlock(&WTCinfo->WanTrafficMutexVar);
WTC_LOG_INFO("[%s-%s] DscpList/SleepInterval is Not Configured"
, wanMode[index]
, WTC_ThreadStatusToStr(thrdStatus));
Expand Down Expand Up @@ -1242,7 +1245,10 @@ static VOID WTC_CreateThread
}
pthread_detach(WTCinfo->WanTrafficThreadId);
}
/* CID 560033 Data race condition (MISSING LOCK) */
pthread_mutex_lock(&WTCinfo->WanTrafficMutexVar);
WanTrafficCountInfo_t[index]->ThreadState = WTC_THRD_INITIALIZE;
pthread_mutex_unlock(&WTCinfo->WanTrafficMutexVar);
return;
}

Expand Down
8 changes: 6 additions & 2 deletions source/lm/cosa_wantraffic_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,13 @@ static pstDSCPInfo_t DeleteDisabledDscp(pstDSCPInfo_t DscpTree, pstDSCPInfo_t* i
**********************************************************************/
static pstDSCPInfo_t DeleteDisabledClients(pstDSCPInfo_t DscpTree)
{
UINT index = DscpTree->NumClients;
int index = DscpTree->NumClients;
errno_t rc = -1;
for(UINT i=0; i<index; i++)
/* CID 559949 Overflowed constant (INTEGER_OVERFLOW) */
/* Changed UINT i=0 to int i=0 */
/* When i=0, and i-- causes underflow. unsigned integer is defined to wrap around module 2^n,*/
/* where n is bit width. As a result, i becomes 4294967295 ((0-1) mod 2^32 = 2^32 -1 = 4294967295)*/
for(int i=0; i<index; i++)
{
if (DscpTree->ClientList[i].IsUpdated == FALSE)
{
Expand Down
19 changes: 16 additions & 3 deletions source/lm/lm_main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/lm/lm_main.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/lm/lm_main.c' (Match: rdkb/components/opensource/ccsp/CcspLMLite/rdkb/components/opensource/ccsp/CcspLMLite/c00814e, 3984 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspLMLite/+archive/c00814e5729ce458208cf2b70c303126c5dcef1b.tar.gz, file: source/lm/lm_main.c)

Check failure on line 2 in source/lm/lm_main.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/lm/lm_main.c' (Match: rdkb/components/opensource/ccsp/CcspLMLite/rdkb/components/opensource/ccsp/CcspLMLite/1, 4641 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspLMLite/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/lm/lm_main.c)

Check failure on line 2 in source/lm/lm_main.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/lm/lm_main.c' (Match: rdkb/components/opensource/ccsp/CcspLMLite/rdkb/components/opensource/ccsp/CcspLMLite/2101, 4641 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspLMLite/+archive/rdk-dev-2101.tar.gz, file: source/lm/lm_main.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -2239,8 +2239,8 @@
LanManager_CheckCloneCopy(&(pHost->pStringParaValue[LM_HOST_Layer1InterfaceId]), (const char *)hosts[i].ssid);
LanManager_CheckCloneCopy(&(pHost->pStringParaValue[LM_HOST_AssociatedDeviceId]), (const char *)hosts[i].AssociatedDevice);
pHost->iIntParaValue[LM_HOST_X_CISCO_COM_RSSIId] = hosts[i].RSSI;
pHost->l1unReachableCnt = 1;
pHost->bBoolParaValue[LM_HOST_ActiveId] = hosts[i].Status;
pHost->l1unReachableCnt = 1;
pHost->activityChangeTime = time((time_t*)NULL);
LanManager_CheckCloneCopy(&(pHost->pStringParaValue[LM_HOST_X_RDKCENTRAL_COM_Parent]), getFullDeviceMac());
LanManager_CheckCloneCopy(&(pHost->pStringParaValue[LM_HOST_X_RDKCENTRAL_COM_DeviceType]), " ");
Expand Down Expand Up @@ -3140,7 +3140,13 @@
}
while (1);

pthread_exit(NULL);
/* CID 559679 Structurally dead code (UNREACHABLE) */
/* Since thread runs indefinitely with while(1) loop, both 'pthread_exit()' and 'return NULL' */
/* is unreached, however return is prefered over function call as per most coding standards */
/* Uncomment it, when thread is modified to run definite number of times in future */
// pthread_exit(NULL);

return NULL;
}

static void *ValidateHost_Thread (void *arg)
Expand Down Expand Up @@ -3194,7 +3200,14 @@
UpdateHostRetryValidateList(&ValidateHostMsg, ACTION_FLAG_ADD);
}
} while(1);
pthread_exit(NULL);

/* CID 559600 Structurally dead code (UNREACHABLE) */
/* Since thread runs indefinitely with while(1) loop, both 'pthread_exit()' and 'return NULL' */
/* is unreached, however return is prefered over function call as per most coding standards */
/* Uncomment it, when thread is modified to run definite number of times in future */
//pthread_exit(NULL);

return NULL;
}

static const char *compName = "LOG.RDK.LM";
Expand Down
2 changes: 1 addition & 1 deletion source/lm/lm_main.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/lm/lm_main.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/lm/lm_main.h' (Match: rdkb/components/opensource/ccsp/CcspLMLite/rdkb/components/opensource/ccsp/CcspLMLite/1, 293 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspLMLite/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/lm/lm_main.h)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -213,7 +213,7 @@
int active;
int l3unReachableCnt;
char *pStringParaValue[LM_HOST_IPAddress_NumStringPara];
int LeaseTime;
ULONG LeaseTime; /* Changed int -> ULONG to fix CID 559502 Overflowed constant (INTEGER_OVERFLOW) */
int instanceNum; /* instance number */
struct _LmObjectHostIPAddress *pNext;
}
Expand Down
30 changes: 30 additions & 0 deletions source/lm/network_devices_status_avropack.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/lm/network_devices_status_avropack.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/lm/network_devices_status_avropack.c' (Match: rdkb/components/opensource/ccsp/CcspLMLite/rdkb/components/opensource/ccsp/CcspLMLite/1, 702 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspLMLite/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/lm/network_devices_status_avropack.c)
* following copyright and licenses apply:
*
* Copyright 2016 RDK Management
Expand Down Expand Up @@ -261,6 +261,12 @@
#endif
tstamp_av_main = tstamp_av_main/1000;

// CID 339693 - Explicit null dereferenced (FORWARD_NULL)
if (optional.iface == NULL)
{
CcspTraceWarning(("optional.iface is NULL"));
return;
}
avro_value_set_long(&optional, tstamp_av_main );
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, timestamp = ""%" PRId64 "\n", tstamp_av_main ));
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, timestamp\tType: %d\n", avro_value_get_type(&optional)));
Expand Down Expand Up @@ -427,8 +433,20 @@
// assume 1 parent ONLY
// Parent MAC
avro_value_set_branch(&adrField, 1, &parent_optional);
// CID 559659 - Explicit null dereferenced (FORWARD_NULL)
if (parent_optional.iface == NULL)
{
CcspTraceWarning(("parent_optional.iface is NULL"));
return;
}
avro_value_get_by_name(&parent_optional, "mac_address", &parent_adrField, NULL);
if ( CHK_AVRO_ERR ) CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, %s\n", avro_strerror()));
// CID 559459 - Explicit null dereferenced (FORWARD_NULL)
if (parent_adrField.iface == NULL)
{
CcspTraceWarning(("parent_adrField.iface is NULL"));
return;
}
avro_value_set_branch(&parent_adrField, 1, &parent_optional);
avro_value_set_fixed(&parent_optional, CpeMacid, 6);
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, parent mac_address\tType: %d\n", avro_value_get_type(&parent_optional)));
Expand Down Expand Up @@ -487,6 +505,12 @@

//Append a DeviceReport item to array
avro_value_append(&adrField, &dr, NULL);
//CID 559702 Explicit null dereferenced (FORWARD_NULL)
if (dr.iface == NULL)
{
CcspTraceWarning(("dr.iface is NULL"));
break;
}
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, \tDevice Status Report\tType: %d\n", avro_value_get_type(&dr)));

//data array block
Expand All @@ -508,6 +532,12 @@
//device_mac - fixed 6 bytes
avro_value_get_by_name(&dr, "device_id", &drField, NULL);
if ( CHK_AVRO_ERR ) CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, %s\n", avro_strerror()));
//CID 559702 Explicit null dereferenced (FORWARD_NULL)
if (drField.iface == NULL)
{
CcspTraceWarning(("drField.iface is NULL"));
break;
}
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, device_id\tType: %d\n", avro_value_get_type(&drField)));
avro_value_get_by_name(&drField, "mac_address", &drField, NULL);
if ( CHK_AVRO_ERR ) CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, %s\n", avro_strerror()));
Expand Down
19 changes: 19 additions & 0 deletions source/lm/network_devices_traffic_avropack.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/lm/network_devices_traffic_avropack.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/lm/network_devices_traffic_avropack.c' (Match: rdkb/components/opensource/ccsp/CcspLMLite/rdkb/components/opensource/ccsp/CcspLMLite/1, 607 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspLMLite/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/lm/network_devices_traffic_avropack.c)
* following copyright and licenses apply:
*
* Copyright 2016 RDK Management
Expand Down Expand Up @@ -267,6 +267,13 @@
#endif
tstamp_av_main = tstamp_av_main/1000;

// CID 259670 - Explicit null dereferenced (FORWARD_NULL)
if (optional.iface == NULL)
{
CcspTraceWarning(("optional.iface is NULL"));
return;
}

avro_value_set_long(&optional, tstamp_av_main );
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, timestamp = ""%" PRId64 "\n", tstamp_av_main ));

Expand Down Expand Up @@ -426,6 +433,12 @@

//Append a DeviceReport item to array
avro_value_append(&adrField, &dr, NULL);
// CID 274952 #1- Explicit null dereferenced (FORWARD_NULL)
if (dr.iface == NULL)
{
CcspTraceWarning(("dr.iface is NULL"));
break;
}
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, \tDevice Traffic Report\tType: %d\n", avro_value_get_type(&dr)));

//data array block
Expand All @@ -443,6 +456,12 @@
}

//device_mac - fixed 6 bytes
// CID 274952 #2 - Explicit null dereferenced (FORWARD_NULL)
if (dr.iface == NULL)
{
CcspTraceWarning(("dr.iface is NULL"));
break;
}
avro_value_get_by_name(&dr, "device_id", &drField, NULL);
if ( CHK_AVRO_ERR ) CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, %s\n", avro_strerror()));
CcspLMLiteConsoleTrace(("RDK_LOG_DEBUG, device_id\tType: %d\n", avro_value_get_type(&drField)));
Expand Down
Loading