Skip to content

RDKB-65853: Fixing coverity issue#1252

Open
navyasher wants to merge 1 commit into
rdkcentral:developfrom
navyasher:Kondamma_cov
Open

RDKB-65853: Fixing coverity issue#1252
navyasher wants to merge 1 commit into
rdkcentral:developfrom
navyasher:Kondamma_cov

Conversation

@navyasher

Copy link
Copy Markdown
Contributor

Reason for change: Fixing coverity issues.
Test Procedure: Build should be successful and the regression test should also succeed
Risks: Low
Priority: P1
Signed-off-by: Navya_Sheregar@comcast.com

@navyasher
navyasher requested a review from a team as a code owner July 8, 2026 07:35
Copilot AI review requested due to automatic review settings July 8, 2026 07: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.

Pull request overview

This PR addresses multiple Coverity findings across the WiFi codebase, primarily around memory/resource handling (JSON object creation, Avro interface ref-counting, and safer realloc() usage).

Changes:

  • Remove redundant/unreachable cJSON_CreateObject() allocations and cJSON_Delete(NULL) calls in webconfig encoders.
  • Add missing Avro interface decref calls (avro_value_iface_decref) after telemetry record creation.
  • Harden realloc() usage in mesh scan result processing and datapipeline stats copying.

Reviewed changes

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

Show a summary per file
File Description
source/webconfig/wifi_encoder.c Removes redundant JSON object allocations and unnecessary deletes in encoder loops.
source/stats/wifi_associated_devices_msmt.c Adds missing avro_value_iface_decref(iface) in cleanup path.
source/services/mesh/wifi_service_mesh.c Uses a temporary pointer for realloc() and handles allocation failure safely.
source/dml/tr_181/ml/cosa_apis_util.c Updates realloc() pattern in IPv6 address parsing (currently introduces an OOB bug).
source/core/services/vap_svc_mesh_ext.c Mirrors safer realloc() handling for scan list growth.
source/apps/harvester/wifi_harvester.c Adds missing avro_value_iface_decref(iface) in cleanup path.
lib/datapipeline/dppline.c Adds realloc() failure handling and corrects sizing/type usage in some allocations.

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

Comment thread source/dml/tr_181/ml/cosa_apis_util.c Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 07:23

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 8 out of 8 changed files in this pull request and generated 4 comments.

Comment thread source/dml/tr_181/ml/cosa_apis_util.c
Comment thread source/services/mesh/wifi_service_mesh.c
Comment thread source/core/services/vap_svc_mesh_ext.c
Comment thread source/core/services/vap_svc_mesh_ext.c Outdated
Copilot AI review requested due to automatic review settings July 13, 2026 06:25

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 8 out of 8 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

lib/datapipeline/dppline.c:589

  • The thermal records copy path still uses calloc()/realloc() without checking for allocation failure, and then immediately dereferences dst->u.device.thermal_list. This can crash on OOM and also leak the original buffer in the realloc() case.
                    thermal_size = (dst->u.device.thermal_qty + 1) * sizeof(dpp_device_thermal_record_t);
                    if (!dst->u.device.thermal_qty)
                    {
                        dst->u.device.thermal_list = calloc(1, thermal_size);
                    }

Comment thread source/dml/tr_181/ml/cosa_apis_util.c
Comment thread lib/datapipeline/dppline.c
Comment thread source/services/mesh/wifi_service_mesh.c
Comment thread source/core/services/vap_svc_mesh_ext.c
Reason for change: Fixing coverity issues.
Test Procedure: Build should be successful and the regression test should also succeed
Risks: Low
Priority: P1
Signed-off-by: Navya_Sheregar@comcast.com
Copilot AI review requested due to automatic review settings July 13, 2026 09:28

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 8 out of 8 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

lib/datapipeline/dppline.c:589

  • In the device thermal-record copy loop, calloc() / realloc() results aren’t checked before memset()/memcpy(). If an allocation fails, this will dereference NULL. Please add allocation-failure handling consistent with the other realloc() fixes in this PR.
                    thermal_size = (dst->u.device.thermal_qty + 1) * sizeof(dpp_device_thermal_record_t);
                    if (!dst->u.device.thermal_qty)
                    {
                        dst->u.device.thermal_list = calloc(1, thermal_size);
                    }

Comment thread source/services/mesh/wifi_service_mesh.c
Comment thread source/core/services/vap_svc_mesh_ext.c
Comment thread source/platform/linux/he_bus/src/he_bus_connection.c
Comment thread source/dml/tr_181/ml/cosa_apis_util.c
Comment thread lib/datapipeline/dppline.c
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