-
Notifications
You must be signed in to change notification settings - Fork 34
RDKB-60656 : Available memory check for firmware downloads #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
098f630
5a93dff
4ce3a7c
ca27857
a197802
0ee0524
f06296b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
|
||
|
|
||
| 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
|
||||
| * following copyright and licenses apply: | ||||
| * | ||||
| * Copyright 2015 RDK Management | ||||
|
|
@@ -98,6 +98,7 @@ | |||
| #include "cosa_drg_common.h" | ||||
| #include "safec_lib_common.h" | ||||
| #include "ansc_string_util.h" | ||||
| #include "fw_download_check.h" | ||||
bunnam988 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
| #include "fw_download_check.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/TR-181/middle_layer_src/cosa_deviceinfo_dml.c
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * following copyright and licenses apply: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Copyright 2015 RDK Management | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
| 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
AI
Jan 21, 2026
There was a problem hiding this comment.
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
AI
Jan 21, 2026
There was a problem hiding this comment.
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
AI
Jan 21, 2026
There was a problem hiding this comment.
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
AI
Jan 21, 2026
There was a problem hiding this comment.
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
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.