Skip to content

Update rfc_xconf_handler.cpp#185

Open
nhanasi wants to merge 3 commits into
developfrom
feature/cv_test
Open

Update rfc_xconf_handler.cpp#185
nhanasi wants to merge 3 commits into
developfrom
feature/cv_test

Conversation

@nhanasi

@nhanasi nhanasi commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@nhanasi
nhanasi requested a review from a team as a code owner March 9, 2026 16:00
Copilot AI review requested due to automatic review settings March 9, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates RuntimeFeatureControlProcessor::clearDB() to pass arguments to set_RFCProperty using std::move, presumably to reduce string copies when writing TR-181/RFC backing-store values.

Changes:

  • Replaced three set_RFCProperty(name, key, value) calls with set_RFCProperty(std::move(...), ...) in clearDB().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rfcMgr/rfc_xconf_handler.cpp Outdated
Comment on lines +1299 to +1301
set_RFCProperty(std::move(name), std::move(ClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(BootstrapClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(ConfigChangeTimeKey), std::move(ConfigChangeTime));

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

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

std::move(name) is used in the first set_RFCProperty call and then name is moved again in subsequent calls. After the first move, name is left in a moved-from state (typically empty), so the later set_RFCProperty calls may write to an invalid/empty namespace and fail. Use name normally (no move) or create separate copies for each call / change set_RFCProperty to take const std::string&/std::string_view if you’re trying to avoid copies.

Suggested change
set_RFCProperty(std::move(name), std::move(ClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(BootstrapClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(ConfigChangeTimeKey), std::move(ConfigChangeTime));
set_RFCProperty(name, ClearDB, clearValue);
set_RFCProperty(name, BootstrapClearDB, clearValue);
set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime);

Copilot uses AI. Check for mistakes.
Comment thread rfcMgr/rfc_xconf_handler.cpp Outdated
Comment on lines 1299 to 1303
set_RFCProperty(std::move(name), std::move(ClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(BootstrapClearDB), std::move(clearValue));
set_RFCProperty(std::move(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());

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

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

ClearDB, BootstrapClearDB, ConfigChangeTimeKey, and ConfigChangeTime are moved into set_RFCProperty and then immediately used afterwards in log statements. This will typically log empty strings (moved-from state) and makes debugging harder. Either avoid moving these variables or log before moving / keep separate variables for logging.

Copilot uses AI. Check for mistakes.
@rdkcmf-jenkins

rdkcmf-jenkins commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Coverity Issue - Using a moved object

"ConfigChangeTime" is used after it has been already moved.

High Impact, CWE-457
USE_AFTER_MOVE

Issue location

This issue was discovered outside the diff for this Pull Request. You can find it at:
rfcMgr/rfc_xconf_handler.cpp:1308

set_RFCProperty(std::move(name), std::move(BootstrapClearDB), std::move(clearValue));
set_RFCProperty(std::move(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());

@rdkcmf-jenkins rdkcmf-jenkins Mar 9, 2026

Copy link
Copy Markdown
Contributor

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

"ClearDB" is used after it has been already moved.

High Impact, CWE-457
USE_AFTER_MOVE

Comment thread rfcMgr/rfc_xconf_handler.cpp Outdated
set_RFCProperty(name, BootstrapClearDB, clearValue);
set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime);
set_RFCProperty(std::move(name), std::move(ClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(BootstrapClearDB), std::move(clearValue));

@rdkcmf-jenkins rdkcmf-jenkins Mar 9, 2026

Copy link
Copy Markdown
Contributor

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

"name" is used after it has been already moved.

High Impact, CWE-457
USE_AFTER_MOVE

set_RFCProperty(std::move(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());

@rdkcmf-jenkins rdkcmf-jenkins Mar 9, 2026

Copy link
Copy Markdown
Contributor

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

"BootstrapClearDB" is used after it has been already moved.

High Impact, CWE-457
USE_AFTER_MOVE

Comment thread rfcMgr/rfc_xconf_handler.cpp Outdated
set_RFCProperty(name, BootstrapClearDB, clearValue);
set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime);
set_RFCProperty(std::move(name), std::move(ClearDB), std::move(clearValue));
set_RFCProperty(std::move(name), std::move(BootstrapClearDB), std::move(clearValue));

@rdkcmf-jenkins rdkcmf-jenkins Mar 9, 2026

Copy link
Copy Markdown
Contributor

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

"clearValue" is used after it has been already moved.

High Impact, CWE-457
USE_AFTER_MOVE

Comment thread rfcMgr/rfc_xconf_handler.cpp Outdated
std::string clearValue_mv(std::move(clearValue));

set_RFCProperty(name_mv, std::move(ClearDB), clearValue_mv);
set_RFCProperty(name_mv, std::move(BootstrapClearDB), clearValue_mv);

@rdkcmf-jenkins rdkcmf-jenkins Mar 9, 2026

Copy link
Copy Markdown
Contributor

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 - Variable copied when it could be moved

"clearValue_mv" is passed-by-value as parameter to "std::__cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const &)", when it could be moved instead.

Low Impact, CWE-none
COPY_INSTEAD_OF_MOVE

How to fix

Use "std::move(""clearValue_mv"")" instead of "clearValue_mv".

Comment thread rfcMgr/rfc_xconf_handler.cpp Outdated

set_RFCProperty(name_mv, std::move(ClearDB), clearValue_mv);
set_RFCProperty(name_mv, std::move(BootstrapClearDB), clearValue_mv);
set_RFCProperty(name_mv, std::move(ConfigChangeTimeKey), std::move(ConfigChangeTime));

@rdkcmf-jenkins rdkcmf-jenkins Mar 9, 2026

Copy link
Copy Markdown
Contributor

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 - Variable copied when it could be moved

"name_mv" is passed-by-value as parameter to "std::__cxx11::basic_string<char, std::char_traits, std::allocator >::basic_string(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const &)", when it could be moved instead.

Low Impact, CWE-none
COPY_INSTEAD_OF_MOVE

How to fix

Use "std::move(""name_mv"")" instead of "name_mv".

Copilot AI review requested due to automatic review settings March 9, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

set_RFCProperty(name, ClearDB, clearValue);
set_RFCProperty(name, BootstrapClearDB, clearValue);
set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime);
set_RFCProperty(name, ClearDB, std::move(clearValue));

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

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

Indentation on this line uses a tab while surrounding lines use spaces, which makes formatting inconsistent. Align indentation with the existing spacing style in this function/file.

Suggested change
set_RFCProperty(name, ClearDB, std::move(clearValue));
set_RFCProperty(name, ClearDB, std::move(clearValue));

Copilot uses AI. Check for mistakes.
set_RFCProperty(name, BootstrapClearDB, clearValue);
set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime);
set_RFCProperty(name, ClearDB, std::move(clearValue));
set_RFCProperty(name, BootstrapClearDB, std::move(clearValue));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Using a moved object

"clearValue" is used after it has been already moved.

High Impact, CWE-457
USE_AFTER_MOVE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants