RDKB-65853: Fixing coverity issue#1252
Open
navyasher wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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 andcJSON_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.
Kondamma123
force-pushed
the
Kondamma_cov
branch
from
July 13, 2026 06:25
72f9ec2 to
c7b1f7c
Compare
Contributor
There was a problem hiding this comment.
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 dereferencesdst->u.device.thermal_list. This can crash on OOM and also leak the original buffer in therealloc()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);
}
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
Kondamma123
force-pushed
the
Kondamma_cov
branch
from
July 13, 2026 09:28
c7b1f7c to
369b58b
Compare
Contributor
There was a problem hiding this comment.
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 beforememset()/memcpy(). If an allocation fails, this will dereference NULL. Please add allocation-failure handling consistent with the otherrealloc()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);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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