-
Notifications
You must be signed in to change notification settings - Fork 6
RDK-60308-[tr69hostif, RFC] RDK Coverity Defect Resolution for Device Management #143
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
base: develop
Are you sure you want to change the base?
Changes from 5 commits
a33fd4b
901bc15
2baaf23
e2360e6
e03568e
7bf89e2
ad72760
aa456bd
7206ff9
83950ae
cb05e91
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1295,12 +1295,12 @@ void RuntimeFeatureControlProcessor::clearDB(void) | |||||
| std::ofstream touch_file(TR181STOREFILE); | ||||||
| touch_file.close(); | ||||||
|
|
||||||
| set_RFCProperty(name, ClearDB, clearValue); | ||||||
| set_RFCProperty(name, BootstrapClearDB, clearValue); | ||||||
| set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime); | ||||||
| set_RFCProperty(name, std::move(ClearDB), clearValue); | ||||||
| set_RFCProperty(name, std::move(BootstrapClearDB), clearValue); | ||||||
| set_RFCProperty(name, std::move(ConfigChangeTimeKey), std::move(ConfigChangeTime)); | ||||||
|
|
||||||
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing DB Value: %s\n", __FUNCTION__,__LINE__,ClearDB.c_str()); | ||||||
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Bootstrap Clearing DB Value: %s\n", __FUNCTION__,__LINE__,BootstrapClearDB.c_str()); | ||||||
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing DB Value\n", __FUNCTION__,__LINE__); | ||||||
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Bootstrap Clearing DB Value\n", __FUNCTION__,__LINE__); | ||||||
|
Comment on lines
+1302
to
+1303
|
||||||
| RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ConfigChangeTime: %s\n", __FUNCTION__,__LINE__,ConfigChangeTime.c_str()); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverity issue no longer present as of: undefined Show issueCoverity Issue - Using a moved object"ConfigChangeTime" is used after it has been already moved. High Impact, CWE-457
|
||||||
|
|
||||||
| #else | ||||||
|
|
@@ -1342,7 +1342,7 @@ void RuntimeFeatureControlProcessor::rfcStashRetrieveParams(void) | |||||
|
|
||||||
| std::string name = "rfc"; | ||||||
|
|
||||||
| WDMP_STATUS status = set_RFCProperty(name, RFC_ACCOUNT_ID_KEY_STR, stashAccountId); | ||||||
| WDMP_STATUS status = set_RFCProperty(name, RFC_ACCOUNT_ID_KEY_STR, std::move(stashAccountId)); | ||||||
|
||||||
| WDMP_STATUS status = set_RFCProperty(name, RFC_ACCOUNT_ID_KEY_STR, std::move(stashAccountId)); | |
| WDMP_STATUS status = set_RFCProperty(name, RFC_ACCOUNT_ID_KEY_STR, stashAccountId); |
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.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Using a moved object
"ClearDBEndKey" is used after it has been already moved.
High Impact, CWE-457
USE_AFTER_MOVE
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.
Coverity issue no longer present as of: undefined
Show issue
Coverity Issue - Using a moved object
"BootstrapClearDBEndKey" is used after it has been already moved.
High Impact, CWE-457
USE_AFTER_MOVE
Vismalskumar0 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Copilot
AI
Jan 14, 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 TOCTOU fix is correct in removing the race condition between stat() and remove(). However, silently ignoring all remove() failures (via void cast) may hide legitimate errors like permission issues. Consider logging at DEBUG level if remove() fails, checking errno to distinguish between "file not found" (expected race condition) and other errors like EACCES (permission denied).
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.
@copilot open a new pull request to apply changes based on this feedback
Copilot
AI
Jan 22, 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.
Using std::move on a local variable (value) to assign to a member variable (_valid_accountId) prevents copy elision and doesn't provide any benefit here since the local variable is going out of scope anyway. Additionally, if value is moved and later accessed in the logging or comparisons that follow, it would be in an undefined state. In this case, the move appears safe since value is not used after the assignment, but it's unnecessary and could be confusing. Consider removing std::move and letting the compiler optimize the assignment.
| _valid_accountId = std::move(value); | |
| _valid_accountId = value; |
Copilot
AI
Jan 22, 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.
Using std::move on a local variable (value) to assign to a member variable (_valid_partnerId) prevents copy elision and doesn't provide any benefit here since the local variable is going out of scope anyway. Additionally, if value is moved and later accessed in logging or comparisons that follow, it would be in an undefined state. In this case, the move appears safe since value is not used after the assignment, but it's unnecessary and could be confusing. Consider removing std::move and letting the compiler optimize the assignment.
| _valid_partnerId = std::move(value); | |
| _valid_partnerId = value; |
Copilot
AI
Jan 22, 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.
Using std::move on a local variable (XconfUrl) to assign to a member variable (_xconf_server_url) prevents copy elision and doesn't provide any benefit here since the local variable is going out of scope anyway. Consider removing std::move and letting the compiler optimize the assignment.
| _xconf_server_url = std::move(XconfUrl); | |
| _xconf_server_url = XconfUrl; |
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.
rebase the code
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.
why stb:move needed only for few params?
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||
|
|
||||
|
||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this change needed? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ extern "C" { | |
| namespace xconf { | ||
| class XconfHandler { | ||
| public : | ||
| XconfHandler(){ } | ||
| XconfHandler() : _ebuild_type(RDKB_DEV) { } | ||
|
||
| int initializeXconfHandler(void); | ||
|
|
||
| // We do not allow this class to be copied !! | ||
|
|
||
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.
why we removing the log?