Skip to content
Merged
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
22 changes: 22 additions & 0 deletions config-arm/TR181-USGv2.XML
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,28 @@

<writable>true</writable>

</parameter>
<parameter>

<name>X_RDKCENTRAL-COM_FwDwld_AvlMem_RsrvThreshold</name>

<type>unsignedInt</type>

<syntax>uint32</syntax>

<writable>true</writable>

</parameter>
<parameter>

<name>X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent</name>

<type>unsignedInt</type>

<syntax>uint32</syntax>

<writable>true</writable>

</parameter>

<parameter>
Expand Down
2 changes: 1 addition & 1 deletion source-arm/TR-181/board_sbapi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if CORE_NET_LIB_FEATURE_SUPPORT
libCcspPandM_board_sbapi_la_LDFLAGS += -lnet
endif

libCcspPandM_board_sbapi_la_LDFLAGS = -lccsp_common -ltime_conversion -lwebconfig_framework -lmsgpackc
libCcspPandM_board_sbapi_la_LDFLAGS = -lccsp_common -ltime_conversion -lwebconfig_framework -lmsgpackc -lfw_download_chk
if FEATURE_HOTSPOT_SUPPORT
libCcspPandM_board_sbapi_la_LDFLAGS += -lHotspotApi
endif
Comment on lines +117 to 120
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libCcspPandM_board_sbapi_la_LDFLAGS is being assigned with = here, which overwrites any earlier conditional += additions (e.g., -lrdkconfig from IS_LIBRDKCONFIG_ENABLED and -lnet from CORE_NET_LIB_FEATURE_SUPPORT just above). This will silently drop those link dependencies in configurations where they’re enabled. Consolidate into a single base assignment and only use += afterwards, or change this to += -lfw_download_chk instead of reassigning the whole variable.

Copilot uses AI. Check for mistakes.
Expand Down
7 changes: 7 additions & 0 deletions source-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.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-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.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-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 5552 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.c)

Check failure on line 2 in source-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.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-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/2102, 5552 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/rdk-dev-2102.tar.gz, file: source-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -98,6 +98,7 @@
#include "cosa_drg_common.h"
#include "safec_lib_common.h"
#include "ansc_string_util.h"
#include "fw_download_check.h"
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fw_download_check.h is not present anywhere in this repo, so this include will fail unless the build environment provides it via an external -I path/package. Please add the header to the repo (or ensure it’s exported by a declared dependency and included via the correct include path), and update the build system accordingly so local builds don’t break.

Suggested change
#include "fw_download_check.h"

Copilot uses AI. Check for mistakes.

#define DEVICE_PROPERTIES "/etc/device.properties"
#define PARTNERS_INFO_FILE "/nvram/partners_defaults.json"
Expand Down Expand Up @@ -4732,6 +4733,12 @@
}

CcspTraceWarning(("%s: ImageName %s, url %s\n", __FUNCTION__, Imagename, URL));
if(can_proceed_fw_download() == FW_DWNLD_MEMCHK_NOT_ENOUGH_MEM)
{
CcspTraceError(("FirmwareDownloadAndFactoryReset : Not enough memory to proceed firmware download\n"));
commonSyseventSet("fw_update_inprogress", "false");
return NULL;
}
if( RETURN_ERR == cm_hal_FWupdateAndFactoryReset( URL, Imagename ))
{
CcspTraceError(("FirmwareDownloadAndFactoryReset :cm_hal_FWupdateAndFactoryReset failed for webpa.\n"));
Expand Down
34 changes: 33 additions & 1 deletion source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 10517 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source-pc/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspMoCA/rdkb/components/opensource/ccsp/CcspMoCA/2102, 12200 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspMoCA/+archive/rdk-dev-2102.tar.gz, file: source/TR-181/middle_layer_src/cosa_moca_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/f195aa3, 10695 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/f195aa31c7d3f4bb4bf99ccc5c4f4b0619c2243a.tar.gz, file: source/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 10891 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/2011, 10891 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/rdk-dev-2011.tar.gz, file: source/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/2101, 10754 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/rdk-dev-2101.tar.gz, file: source/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 10813 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)

Check failure on line 2 in source/TR-181/middle_layer_src/cosa_deviceinfo_dml.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/2102, 10813 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/rdk-dev-2102.tar.gz, file: source/TR-181/middle_layer_src/cosa_deviceinfo_dml.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -792,6 +792,22 @@
CosaDmlDiGetFactoryResetCount(NULL,puLong);
return TRUE;
}

if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_AvlMem_RsrvThreshold") == 0)
{
char buf[10]= {0};
syscfg_get( NULL, "FwDwld_AvlMem_RsrvThreshold", buf, sizeof(buf));
*puLong = atoi(buf);
return TRUE;
Comment on lines +796 to +801
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syscfg value is read into char buf[10], which is too small for a uint32 string representation (needs up to 10 digits + NUL). This can truncate the stored value and atoi() will then return the wrong number. Increase the buffer (e.g., 12+) and prefer strtoul with proper error checking instead of atoi (which returns int and can overflow).

Copilot uses AI. Check for mistakes.
}

if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent") == 0)
{
char buf[10]= {0};
syscfg_get( NULL, "FwDwld_ImageProcMemPercent", buf, sizeof(buf));
*puLong = atoi(buf);
Comment on lines +799 to +808
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syscfg_get return value should be checked for errors. Most other syscfg_get calls in this file check the return value and handle errors appropriately. If syscfg_get fails, the buffer may contain garbage data, and atoi will return an unpredictable value. Consider checking the return value and either returning FALSE or setting a default value when syscfg_get fails.

Suggested change
syscfg_get( NULL, "FwDwld_AvlMem_RsrvThreshold", buf, sizeof(buf));
*puLong = atoi(buf);
return TRUE;
}
if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent") == 0)
{
char buf[10]= {0};
syscfg_get( NULL, "FwDwld_ImageProcMemPercent", buf, sizeof(buf));
*puLong = atoi(buf);
if (syscfg_get(NULL, "FwDwld_AvlMem_RsrvThreshold", buf, sizeof(buf)) != 0 || buf[0] == '\0')
{
/* On failure or empty value, default to 0 */
*puLong = 0;
}
else
{
*puLong = (ULONG)atoi(buf);
}
return TRUE;
}
if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent") == 0)
{
char buf[10]= {0};
if (syscfg_get(NULL, "FwDwld_ImageProcMemPercent", buf, sizeof(buf)) != 0 || buf[0] == '\0')
{
/* On failure or empty value, default to 0 */
*puLong = 0;
}
else
{
*puLong = (ULONG)atoi(buf);
}

Copilot uses AI. Check for mistakes.
Comment on lines +799 to +808
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syscfg_get return value should be checked for errors. Most other syscfg_get calls in this file check the return value and handle errors appropriately. If syscfg_get fails, the buffer may contain garbage data, and atoi will return an unpredictable value. Consider checking the return value and either returning FALSE or setting a default value when syscfg_get fails.

Suggested change
syscfg_get( NULL, "FwDwld_AvlMem_RsrvThreshold", buf, sizeof(buf));
*puLong = atoi(buf);
return TRUE;
}
if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent") == 0)
{
char buf[10]= {0};
syscfg_get( NULL, "FwDwld_ImageProcMemPercent", buf, sizeof(buf));
*puLong = atoi(buf);
if (syscfg_get(NULL, "FwDwld_AvlMem_RsrvThreshold", buf, sizeof(buf)) == 0)
{
*puLong = atoi(buf);
}
else
{
/* Default to 0 if syscfg_get fails */
*puLong = 0;
}
return TRUE;
}
if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent") == 0)
{
char buf[10]= {0};
if (syscfg_get(NULL, "FwDwld_ImageProcMemPercent", buf, sizeof(buf)) == 0)
{
*puLong = atoi(buf);
}
else
{
/* Default to 0 if syscfg_get fails */
*puLong = 0;
}

Copilot uses AI. Check for mistakes.
return TRUE;
Comment on lines +796 to +809
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new parameters X_RDKCENTRAL-COM_FwDwld_AvlMem_RsrvThreshold and X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent lack test coverage. The repository has existing tests for similar DeviceInfo parameter getters and setters (see source/test/cosa_deviceinfo_dml_custom_test.cpp). Consider adding tests to verify the get and set functionality for these new parameters, including edge cases like syscfg_get failures.

Copilot uses AI. Check for mistakes.
}

/* CcspTraceWarning(("Unsupported parameter '%s'\n", ParamName)); */
return FALSE;
Expand Down Expand Up @@ -1402,7 +1418,23 @@
fprintf(fp, "%s\n", buff);
fclose(fp);
return TRUE;
}
}

if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_AvlMem_RsrvThreshold") == 0)
{
if (syscfg_set_u_commit (NULL, "FwDwld_AvlMem_RsrvThreshold", uValue) != 0) {
return FALSE;
}
return TRUE;
}
Comment on lines +1423 to +1429
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is inconsistent in this block. The opening brace should be indented consistently with the surrounding code, and the return statement should be indented properly. Compare with the similar code block at lines 1431-1437 which has the same indentation issue.

Copilot uses AI. Check for mistakes.
Comment on lines +1423 to +1429
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no input validation for the uValue parameter. Consider adding validation to ensure the value is within a reasonable range. For example, if these values represent memory thresholds in MB or percentages, you should validate that they don't exceed system limits or are within expected ranges (e.g., 0-100 for percentages). Without validation, invalid values could cause unexpected behavior in the firmware download memory check.

Copilot uses AI. Check for mistakes.

if (strcmp(ParamName, "X_RDKCENTRAL-COM_FwDwld_ImageProcMemPercent") == 0)
{
if (syscfg_set_u_commit (NULL, "FwDwld_ImageProcMemPercent", uValue) != 0) {
return FALSE;
}
return TRUE;
}
Comment on lines +1431 to +1437
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no input validation for the uValue parameter. Consider adding validation to ensure the value is within a reasonable range. For ImageProcMemPercent, values should likely be in the range 0-100 if this represents a percentage. Without validation, invalid values could cause unexpected behavior in the firmware download memory check.

Copilot uses AI. Check for mistakes.
Comment on lines +1431 to +1437
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is inconsistent in this block. The return statement should be aligned with the if statement rather than the code inside the if block. This inconsistency also exists in the previous block at lines 1423-1429.

Copilot uses AI. Check for mistakes.
/* CcspTraceWarning(("Unsupported parameter '%s'\n", ParamName)); */
return FALSE;
}
Expand Down