Skip to content

RDKB-62334: Fix Coverity defects (1 file) - #436

Merged
shibu-kv merged 8 commits into
developfrom
topic/RDKB-62334
Sep 30, 2026
Merged

shibu-kv merged 8 commits into
developfrom
topic/RDKB-62334

Conversation

@rdkdevpilot

@rdkdevpilot rdkdevpilot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Fix for Coverity Defects

Triggered by: dev-user

Fixed Files

File Line(s) CIDs Checker Types Description
source/bulkdata/t2eventreceiver.c L267 52591 BAD_CHECK_OF_WAIT_COND Data race condition

Fix Summaries

source/bulkdata/t2eventreceiver.c

The fix correctly addresses the BAD_CHECK_OF_WAIT_COND defect in T2ER_EventDispatchThread. In the original code, when pthread_cond_wait() failed (ret != 0), the error was logged but execution fell through to the subsequent code (unlock, sTDMutex lock, re-acquire erMutex) as if the wait had succeeded. This was incorrect because on failure, erMutex is still held by the calling thread (pthread_cond_wait atomically reacquires the mutex before returning, even on error per POSIX), so the mutex must be unlocked before returning. The fix adds a proper unlock of erMutex followed by return NULL in the error branch, which is the correct and minimal fix. The change is minimal (5 lines added), does not introduce new defects, preserves all existing logic in the success path, and correctly handles the mutex state on the error path.

Repository Guidelines Applied

  • .github/copilot-instructions.md (instruction)
  • .github/instructions/c-embedded.instructions.md (instruction)
  • .github/skills/thread-safety-analyzer/SKILL.md (skill)

Activated skills: thread-safety-analyzer

Defect ID: 736257e3-1ee9-4acb-a8b1-7c0b28c99b5c

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.

Copilot review overview

🟢 Approval recommended

The change is minimal, localized, and correctly restores mutex-state correctness on the pthread_cond_wait() failure path without impacting the success path logic.

Review effort: Lite
Findings: None

What changed in this PR

This PR addresses a Coverity-reported thread-safety defect in the Bulk Data Event Receiver dispatch thread by correctly handling the failure path of pthread_cond_wait() in T2ER_EventDispatchThread.

Changes:

  • Ensures erMutex is explicitly unlocked when pthread_cond_wait(&erCond, &erMutex) returns a non-zero error code.
  • Exits the dispatch thread immediately on pthread_cond_wait() failure to avoid continuing execution under an invalid “wait succeeded” assumption.
File Description
source/​bulkdata/​t2eventreceiver.c Fixes the error path for pthread_cond_wait() by unlocking erMutex before returning from the dispatch thread.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |21.4%   1077|71.0%    31|    -      0
bulkdata/profilexconf.c                   |45.5%    501|81.2%    16|    -      0
bulkdata/reportprofiles.c                 |57.6%    585| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.1%    301| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.0%    105|50.0%     6|    -      0
reportgen/reportgen.c                     |55.9%    919| 100%    21|    -      0
scheduler/scheduler.c                     |73.6%    371| 100%    12|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |58.9%    185|66.7%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|60.5%  10169|89.9%   347|    -      0

Copilot AI lite review requested due to automatic review settings September 29, 2026 19:36

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.

Copilot review overview

🟡 Changes recommended

The dispatch thread may terminate while lifecycle state still indicates it is running.

Review effort: Lite
Findings: 1 Low severity

Open (1)

Comment thread source/bulkdata/t2eventreceiver.c
@github-actions

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |23.8%   1090|71.9%    32|    -      0
bulkdata/profilexconf.c                   |45.8%    515|82.4%    17|    -      0
bulkdata/reportprofiles.c                 |57.5%    586| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.1%    301| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.0%    105|50.0%     6|    -      0
reportgen/reportgen.c                     |55.7%    924| 100%    21|    -      0
scheduler/scheduler.c                     |73.6%    371| 100%    12|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |58.9%    185|66.7%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|60.7%  10202|90.0%   349|    -      0

Copilot AI lite review requested due to automatic review settings September 29, 2026 23:38

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.

Copilot review overview

🟡 Changes recommended

The error path can leave the dispatcher state inconsistent, and it lacks a deterministic regression test.

Review effort: Lite
Findings: 1 High severity · 1 Low severity

Open (2)

Comment thread source/bulkdata/t2eventreceiver.c
@github-actions

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |27.0%   1130|73.5%    34|    -      0
bulkdata/profilexconf.c                   |45.8%    515|82.4%    17|    -      0
bulkdata/reportprofiles.c                 |57.5%    586| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.1%    301| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.0%    105|50.0%     6|    -      0
reportgen/reportgen.c                     |55.7%    924| 100%    21|    -      0
scheduler/scheduler.c                     |73.6%    371| 100%    12|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |63.8%    185|73.3%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|61.0%  10242|90.3%   351|    -      0

Copilot AI lite review requested due to automatic review settings September 30, 2026 15:51

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.

Copilot review overview

🔵 Needs a closer look

The dispatch-thread failure path must update lifecycle state and coordinate thread cleanup.

Review effort: Lite
Findings: 1 High severity · 1 Low severity

Open (2)

@github-actions

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |27.0%   1130|73.5%    34|    -      0
bulkdata/profilexconf.c                   |45.8%    515|82.4%    17|    -      0
bulkdata/reportprofiles.c                 |57.5%    586| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.1%    301| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.0%    105|50.0%     6|    -      0
reportgen/reportgen.c                     |55.7%    924| 100%    21|    -      0
scheduler/scheduler.c                     |70.2%    413| 100%    13|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |63.8%    185|73.3%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|60.9%  10284|90.3%   352|    -      0

Copilot AI lite review requested due to automatic review settings September 30, 2026 16:13

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.

Copilot review overview

🟡 Changes recommended

Unresolved lifecycle, production API, and synchronization-test issues remain.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
Resolved since last review (2)

Comment thread source/bulkdata/t2eventreceiver.c Outdated
Comment thread source/test/bulkdata/profileTest.cpp Outdated
Copilot AI lite review requested due to automatic review settings September 30, 2026 16:35

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.

Copilot review overview

🟡 Changes recommended

Critical worker lifecycle issues remain unresolved, and the regression test does not validate a real threaded lifecycle.

Review effort: Lite
Findings: 2 High severity

Open (2)
Resolved since last review (2)

Comment thread source/bulkdata/t2eventreceiver.c Outdated
Comment on lines +286 to +290
stopDispatchThread = true;
pthread_mutex_unlock(&sTDMutex);
}
else
{
Comment thread source/bulkdata/t2eventreceiver.c Outdated
Comment on lines +575 to +579
ret = pthread_detach(erThread);
if(ret != 0)
{
T2Error("%s pthread_detach for erThread failed with error code %d\n", __FUNCTION__, ret);
}
@github-actions

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |27.0%   1130|73.5%    34|    -      0
bulkdata/profilexconf.c                   |45.8%    515|82.4%    17|    -      0
bulkdata/reportprofiles.c                 |57.5%    586| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |68.7%    316| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.0%    105|50.0%     6|    -      0
reportgen/reportgen.c                     |55.7%    924| 100%    21|    -      0
scheduler/scheduler.c                     |70.2%    413| 100%    13|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |63.8%    185|73.3%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|61.0%  10299|90.3%   352|    -      0

Copilot AI lite review requested due to automatic review settings September 30, 2026 16:58

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.

Copilot review overview

🔵 Needs a closer look

Add a deterministic regression test covering the wait-failure path.

Review effort: Lite
Findings: 2 High severity

Open (2)

@github-actions

Copy link
Copy Markdown

Code Coverage Summary

                                         |Lines       |Functions  |Branches    
Filename                                  |Rate     Num|Rate    Num|Rate     Num
================================================================================
[/mnt/L1_CONTAINER_SHARED_VOLUME/source/]
bulkdata/datamodel.c                      |72.5%    218|88.9%     9|    -      0
bulkdata/profile.c                        |27.0%   1130|73.5%    34|    -      0
bulkdata/profilexconf.c                   |45.8%    515|82.4%    17|    -      0
bulkdata/reportprofiles.c                 |57.5%    586| 100%    27|    -      0
bulkdata/t2eventreceiver.c                |64.1%    301| 100%    10|    -      0
bulkdata/t2markers.c                      |80.5%    169|83.3%    12|    -      0
ccspinterface/busInterface.c              |86.8%     53|85.7%     7|    -      0
ccspinterface/rbusInterface.c             |74.3%    946|97.2%    36|    -      0
commonlib/telemetry_busmessage_sender.c   |40.4%    396|84.2%    19|    -      0
dcautil/dca.c                             |71.7%    674| 100%    20|    -      0
dcautil/dcaproc.c                         |84.3%    230| 100%     7|    -      0
dcautil/dcautil.c                         |78.9%    185| 100%     6|    -      0
dcautil/legacyutils.c                     |79.0%    105| 100%     7|    -      0
privacycontrol/rdkservices_privacyutils.c | 100%     11| 100%     2|    -      0
protocol/http/curlinterface.c             | 100%     24| 100%     3|    -      0
protocol/http/multicurlinterface.c        |59.7%    375|80.0%    10|    -      0
protocol/rbusMethod/rbusmethodinterface.c |60.0%    105|50.0%     6|    -      0
reportgen/reportgen.c                     |55.7%    924| 100%    21|    -      0
scheduler/scheduler.c                     |70.2%    413| 100%    13|    -      0
t2parser/t2parser.c                       |59.4%   1939|88.5%    26|    -      0
t2parser/t2parserxconf.c                  |89.7%    195| 100%     3|    -      0
utils/persistence.c                       |78.7%    253| 100%    10|    -      0
utils/t2MtlsUtils.c                       |82.6%     46|75.0%     4|    -      0
utils/t2collection.c                      |89.6%    201| 100%    18|    -      0
utils/t2common.c                          |63.8%    185|73.3%    15|    -      0
utils/t2log_wrapper.c                     |69.2%     26|50.0%     2|    -      0
utils/vector.c                            |94.9%     79| 100%     8|    -      0
================================================================================
                                   Total:|60.9%  10284|90.3%   352|    -      0

@shibu-kv

Copy link
Copy Markdown
Contributor

L2 failure are due to infra issues caused by a bad release from native container having below changes :
rdkcentral/docker-device-mgt-service-test#165

Overriding and merging for now to unblock the progress.

@shibu-kv
shibu-kv merged commit b07ab5a into develop Sep 30, 2026
15 of 16 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants