Skip to content

RDKBWIFI-364 : Generalizing bus abstraction functions for retrieving and setting bus data property types.#1020

Open
hp490 wants to merge 1 commit intordkcentral:developfrom
hp490:bus_new
Open

RDKBWIFI-364 : Generalizing bus abstraction functions for retrieving and setting bus data property types.#1020
hp490 wants to merge 1 commit intordkcentral:developfrom
hp490:bus_new

Conversation

@hp490
Copy link
Copy Markdown
Contributor

@hp490 hp490 commented Mar 30, 2026

Reason for change : Converted the generic raw_data type to bus_data_prop_t.
Risks: Medium
Priority: P0
Test Procedure: Flash the image and verify that all OneWifi-related features work properly.

@hp490 hp490 requested a review from a team as a code owner March 30, 2026 12:17
@github-actions github-actions bot added the community contribution Contributions from community. label Mar 30, 2026
@amarnathhullur
Copy link
Copy Markdown
Contributor

Gerrit link: https://gerrit.teamccp.com/#/c/952003/ (for internal comcast builds)

@hp490 hp490 force-pushed the bus_new branch 5 times, most recently from 6e5a004 to 69aac56 Compare April 2, 2026 17:40
…and setting bus data property types.

Reason for change : Converted the generic raw_data type to bus_data_prop_t.
Risks: Medium
Priority:P0
Test Procedure: Flash the image and verify that all OneWifi-related features work properly.
@hp490
Copy link
Copy Markdown
Contributor Author

hp490 commented Apr 2, 2026

gerrit: https://gerrit.teamccp.com/#/c/952499/ (26Q2_sprint)
gerrit:https://gerrit.teamccp.com/#/c/952506/ (26Q1_sprint)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 the RDKB/HE bus abstraction to use bus_data_prop_t (property-list style payloads) instead of the older generic raw_data_t for method/event object handling, enabling generalized retrieval/setting of bus object/property types.

Changes:

  • Added RBUS object-to-bus_data_prop_t conversion and updated RBUS method/event paths to use property-list payloads.
  • Updated multiple consumer callback signatures/usages across the codebase to accept bus_data_prop_t / he_bus_data_object_t.
  • Hardened bus_release_data_prop to safely handle NULL inputs and optional num_prop tracking.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
source/platform/rdkb/bus.c Introduces RBUS object/property list conversion and updates method/event handlers to use bus_data_prop_t.
source/platform/linux/he_bus/src/he_bus_data_conversion.c Adjusts subscribe-callback invocation to pass he_bus_data_object_t and simplifies userdata usage.
source/platform/linux/he_bus/inc/he_bus_core.h Updates consumer subscription callback typedef to accept he_bus_data_object_t*.
source/platform/common/data_model/wfa/wfa_data_model.c Updates sync handler signatures to use bus_data_prop_t*.
source/platform/common/bus_common.h Updates bus method and event subscription handler typedefs to use bus_data_prop_t*.
source/platform/common/bus_common.c Makes bus_release_data_prop tolerant of NULL p_data_prop / num_prop.
source/dml/dml_webconfig/dml_onewifi_api.c Updates event callback to read payload from bus_data_prop_t.value.
source/db/wifi_db_apis.c Updates subscription handler signature to use bus_data_prop_t*.
source/core/wifi_ctrl_rbus_handlers.c Updates multiple event handlers and one method handler to use bus_data_prop_t.value.
source/apps/sm/wifi_sm.c Updates SM event handler to consume bus_data_prop_t.value.
source/apps/csi/wifi_csi_analytics.c Updates placeholder handler signature to use bus_data_prop_t*.
Comments suppressed due to low confidence (1)

source/apps/sm/wifi_sm.c:842

  • This subscription callback is invoked from the bus layer with a (char*, bus_data_prop_t*, void*) signature. Defining it with only two parameters is undefined behavior when called through the expected function pointer type (even if userData is always NULL today). Update the handler signature to accept the userData parameter (and ignore it if unused) to match the bus callback type.
static void sm_app_enable_handler(char *event_name, bus_data_prop_t *p_data)
{
    bool sm_app_enable;

    wifi_util_dbg_print(WIFI_SM, "%s:%d recvd event\n", __func__, __LINE__);

    if ((strcmp(event_name, BUS_SM_APP_ENABLE) != 0) ||
        (p_data->value.data_type != bus_data_type_boolean)) {
        wifi_util_error_print(WIFI_SM, "%s:%d invalid event received,%s:%x\n", __func__, __LINE__,
            event_name, p_data->value.data_type);
        return;
    }

    sm_app_enable = p_data->value.raw_data.b;

    push_event_to_ctrl_queue(&sm_app_enable, sizeof(sm_app_enable), wifi_event_type_command,
        wifi_event_type_sm_app_enable, NULL);
}

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

goto cleanup;
}
memcpy(prop->name, prop_name, name_len + 1);
prop->name_len = (uint32_t)name_len;
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

bus_data_prop_t.name_len appears to be treated elsewhere as the string length including the null terminator (e.g., bus_set_raw_data_prop sets name_len = strlen(event_name) + 1). Here name_len is set to strlen(prop_name) (excluding the terminator), which can break any code that uses name_len for serialization/copying. Set prop->name_len to include the terminating '\0' (or align with the project’s established name_len semantics).

Suggested change
prop->name_len = (uint32_t)name_len;
prop->name_len = (uint32_t)(name_len + 1);

Copilot uses AI. Check for mistakes.
rbusProperty_Init(&p, prop_name, v);
rbusObject_SetProperty(outParams, p);
rbusProperty_Release(p);
rbusValue_Release(v);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

After rbusProperty_Init + rbusObject_SetProperty, the rbusObject_t/rbusProperty_t typically owns the rbusValue_t (see bus_method_invoke in this file where the value is not explicitly released after attaching it to an object). Releasing v here risks a use-after-free/double-release when RBUS later cleans up outParams. Consider removing the explicit rbusValue_Release(v) (or otherwise ensure ownership semantics are correct).

Suggested change
rbusValue_Release(v);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution Contributions from community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants