Skip to content

RDKB-66207 BananaPI ci build check overhaul - #1320

Open
mateuszCieslak-GL wants to merge 14 commits into
rdkcentral:developfrom
mateuszCieslak-GL:build_gate
Open

RDKB-66207 BananaPI ci build check overhaul#1320
mateuszCieslak-GL wants to merge 14 commits into
rdkcentral:developfrom
mateuszCieslak-GL:build_gate

Conversation

@mateuszCieslak-GL

@mateuszCieslak-GL mateuszCieslak-GL commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

As part of repo maintenance efforts, this PR expands and starts gating on the build results.

Changes include (might be not exhaustive)

  • pin current runner version to 24.04. GIthub will soon migrate to Ubuntu 26.04. That means changing of used GCC version to 14. This will instantly fail the workflow, as GCC 14 makes implicit function declaration hard error. OneWIfi has over 400+ of such cases. They need fixing regardless, this change gives time to do so.
  • update referenced github actions version. Used versions were pinned to Node version 20, which github will disable in the fall. Updated one use Node 24. Safe for now.
  • increase build coverage. Few applications were missing between ci-build check and full yocto build. They were added.
  • extra coverage flag was added. This adds memwraptool compilation and some db_support. Untill another platform is added (like XB10), this is the cheapest way to check more things.
  • adding support for parallel compilation. Github offers 4 CPUs for runner in public repos and 2 in private ones, till now this was compiled sequentially. Two fixes required for proper ordering added. Fixed mockplatform and rpi makefile too.
  • fixing CSOURCES declarations for OneWifi apps. Enabling them (as part of extending coverage) broken build instantly.
  • adding stubs and fake headers rquired by OneWifi apps, which are added as part of extended coverage. They live under build/linux/compat, not to be used outside the CI-build-check gate context.
  • adding clang-tidy step. Along with flag steering its use to makefile.yml

Preparation for gating builds on code presented in PR :

  1. Separating hostapd code under separate rule - to not emit any gcc warnings.
  2. Scoping out rdk-wifi-hal CFLAGS. As its code is in better shape, this allows 11 warnings promotion to Werror. Without this already fixed issues (as Yocto builds are run with Werror) can be reintroduced. -Wall and -Wextra enabled too, silenced most prominent warnings (as in Yocto).
  3. Scope out OneWifi flags, both CFLAGS and CXX flags. Apply current Yocto warning set. Apply Werr promotion to silent flags. Result should be clean build, only flagging issues added in the PR. They will be displayed on the build summary page.
  4. Generate build summary, listing errors and warnings found. Errors for any of the component build (since they crash the build), Warnings scoped to OneWifi only.
  5. Removing dead code from wifi_em_utils.c (verified with Nikita Hakai). This small change will allow -Wunitialized warning promotion to error as part of next PR.
  6. Present build summary also in job-overview screen - the first place people go to in search of details what went wrong. By default github prints this only on whole workflow summary . In order to see it, one must click on "summary" as additional action. With this change errors will appear straight at build-overview.
  7. Separate -Wformat* class of bugs into "already fixed" and "not yet". Promote first ones to -Werr.
  8. Fix 4 format-truncation places in wifi_db_apis.c . They printed int (which could have 11 chars) into 4 bytes array. Possible overflow, stack smashing and crash. As this was fixed, promote this class of bugs to -Werr.
  9. Uploaded summary of build straight to PR , as a sticky comments.
  10. Merged clang-formatter from PR#1305 to this PR.

BPI Build will be gated on failure only if PR code will introduce warning from the already fixed class (~9Werror flags). For now clang-tidy and clang-formatter won't fail the build.

ToDo (in separate PRs) :
3. Fix single occurences to promote warning flags to errors, so no new-ones are introduced:
- int-conversion: 1 occurence
- stringop-overread: 1
- sizeof-pointer-memaccess: 1
- missing-field-initializers: 2
- format-security: 2
- address: 3
- maybe-uninitialized: 3

Copilot AI review requested due to automatic review settings August 5, 2026 00:10
@mateuszCieslak-GL
mateuszCieslak-GL requested a review from a team as a code owner August 5, 2026 00:10
@mateuszCieslak-GL

Copy link
Copy Markdown
Contributor Author

CC: @bmilcz-comcast @WellPeter @amarnathhullur please take a look

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 overhauls the CI “makefile” build checks to increase build gating coverage (more apps/features), prepare for upcoming GitHub runner/toolchain changes, and make builds faster/more reliable (parallel compilation + better dependency ordering).

Changes:

  • Pin CI runner to Ubuntu 24.04, update GitHub Actions versions, add missing system deps (e.g., protobuf-c), and enable parallel builds (make -j).
  • Expand BananaPi CI coverage (additional OneWifi apps + optional “EXTRA_COVERAGE” tier) and add compat headers/stubs under build/linux/compat to keep the coverage build linkable.
  • Make make -j safe by explicitly ordering program link vs libwifihal.a creation across affected platform makefiles; adjust symbol collision handling (hwaddr_aton weak).

Reviewed changes

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

Show a summary per file
File Description
source/apps/em/wifi_em_utils.h Removes unused radio_index_to_radio_type_str declaration from EM utils.
source/apps/em/wifi_em_utils.c Removes dead/incorrect radio_index_to_radio_type_str implementation.
lib/common/os.c Makes hwaddr_aton weak to avoid link-time symbol collisions in CI coverage builds.
build/linux/rpi/makefile Adds libwifihal.a as an explicit prerequisite for parallel-safe linking; fixes clean spacing.
build/linux/mockplatform/makefile Adds libwifihal.a as an explicit prerequisite for parallel-safe linking.
build/linux/compat/secure_wrapper.h Adds a CI-only compat header for libsecure_wrapper APIs (prototype needs adjustment—see comment).
build/linux/compat/safec_lib_common.h Adds a CI-only compat header mapping a subset of safeclib APIs to libc.
build/linux/compat/rbus/rbus.h Adds an empty stub header to satisfy <rbus/rbus.h> includes in coverage builds.
build/linux/compat/coverage_stubs.c Adds weak, no-op symbols to let coverage builds link without full HAL/DB support.
build/linux/bpi/makefile Adds coverage tiers/flags, expands app/source coverage, adds compat include path + protobuf-c, scopes hostap/HAL warning behavior, and makes linking parallel-safe.
.github/workflows/makefile.yml Pins runner to ubuntu-24.04, updates action versions, installs protobuf-c dev package, enables parallel make, and passes coverage-tier env.

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

Comment thread build/linux/compat/secure_wrapper.h
Copilot AI review requested due to automatic review settings August 5, 2026 00:27

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

Suppressed comments (1)

build/linux/bpi/makefile:648

  • Comment typo: "it's" should be "its" (possessive) in this sentence; also consider capitalizing for readability since this comment documents warning-scoping behavior.
#scope out HOSTAP. so it's code does not generate ANY warnings

Copilot AI review requested due to automatic review settings August 5, 2026 00:34

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

Suppressed comments (3)

build/linux/compat/telemetry_busmessage_sender.h:51

  • The telemetry stub uses non-const parameters and leaves them unused. This can trigger warnings (e.g., discarded qualifiers when calling t2_init("..."), and -Wunused-parameter when compiling the inline stubs). Adjust the signatures to accept const where appropriate and explicitly (void) unused parameters.
static inline void t2_init(char* name) {
    // Stub: do nothing
}

static inline T2ERROR t2_event_s(const char* marker, char* value) {

build/linux/bpi/makefile:648

  • Typo in the new makefile comment: use "its" (possessive) instead of "it's".
#scope out HOSTAP. so it's code does not generate ANY warnings

build/linux/compat/safec_lib_common.h:66

  • The sprintf_s compatibility wrapper currently treats truncation (when vsnprintf returns >= dmax) as success. Real safeclib treats this as an error, and several call sites only check rc < EOK; letting truncation pass here can mask bugs that would fail on real RDK builds. Consider converting truncation into an error return and clearing dest similarly to safeclib constraint handling.
static inline int sprintf_s(char *dest, rsize_t dmax, const char *fmt, ...)
{
    va_list ap;
    int rc;
    if (dest == NULL || fmt == NULL || dmax == 0) {

Copilot AI review requested due to automatic review settings August 5, 2026 16:15

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

Suppressed comments (3)

build/linux/compat/safec_lib_common.h:66

  • sprintf_s wrapper currently returns vsnprintf()'s value directly. On truncation vsnprintf() returns a non-negative value >= dmax, so existing call sites that rely on if (rc < EOK) (e.g. source/apps/whix/wifi_whix.c:315) will treat truncated output as success, diverging from safeclib behavior and potentially hiding real errors. Consider returning a negative value (and clearing dest) when output would not fit.
 * Truncation (output would exceed dmax-1 chars) is an ERROR in real safeclib,
 * which clears dest and returns a negative constraint code (-ESNOSPC) - not the
 * would-be length. vsnprintf instead returns that positive would-be length on
 * truncation, which slips through callers' `rc < EOK` checks and would mask a
 * bug that fails on a real RDK build. Convert it to the safeclib error form. */
static inline int sprintf_s(char *dest, rsize_t dmax, const char *fmt, ...)
{
    va_list ap;
    int rc;
    if (dest == NULL || fmt == NULL || dmax == 0) {
        return -1;
    }

build/linux/compat/telemetry_busmessage_sender.h:28

  • Header comment and inline notes refer to "unit test" usage, but this file is included by non-test code paths in the repo (e.g. include/tr_181/ml/cosa_wifi_internal.h). Updating the wording to match its actual purpose (CI coverage-build compatibility header) will avoid confusion for future maintainers.
/*
 * Mock header for unit test simulation of telemetry_busmessage_sender.h
 */
#ifndef TELEMETRY_BUSMESSAGE_SENDER_H
#define TELEMETRY_BUSMESSAGE_SENDER_H

// Minimal type definitions for unit test
#include <stddef.h>
#include <stdbool.h>

build/linux/bpi/makefile:658

  • This comment line ends with a trailing \, which make will treat as a line-continuation before stripping comments. It’s harmless today because the next line is also a comment, but it’s easy to accidentally turn into a real parsing bug during future edits. Removing the continuation avoids that risk.
# OneWifi/hostap objects are unaffected. Warnings flagged by -Wall and -Wextra stay visible, \

Copilot AI review requested due to automatic review settings August 5, 2026 16:20

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

Suppressed comments (2)

build/linux/compat/telemetry_busmessage_sender.h:34

  • t2_init takes char*, but call sites pass string literals (e.g. t2_init("ccsp-wifi-agent")), which triggers a discarded-qualifiers warning and can become an error under stricter warning policies. Use const char* for the parameter to match typical usage.
static inline void t2_init(char* name) {

build/linux/bpi/makefile:648

  • Typo in comment: use possessive "its" instead of "it's".
#scope out HOSTAP. so it's code does not generate ANY warnings

Copilot AI review requested due to automatic review settings August 5, 2026 17:22

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

Suppressed comments (2)

build/linux/bpi/makefile:677

  • Grammar in comment: "splitted" should be "split".
# never leak onto each other's objects. Warnings are splitted by language used.

build/linux/bpi/makefile:648

  • Typo in comment: use possessive "its" (not "it's").

This issue also appears on line 677 of the same file.

#scope out HOSTAP. so it's code does not generate ANY warnings

Copilot AI review requested due to automatic review settings August 5, 2026 17: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 13 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (3)

build/linux/compat/safec_lib_common.h:102

  • strncpy_s silently truncates when n >= dmax and still returns EOK. Real safeclib treats n >= dmax as a runtime-constraint violation (clears dest and returns non-EOK). The current behavior can mask truncation bugs that would fail on real RDK builds.
static inline errno_t strncpy_s(char *dest, rsize_t dmax, const char *src, rsize_t n)
{
    if (dest == NULL || src == NULL || dmax == 0) {
        return -1;
    }
    if (n >= dmax) {
        n = dmax - 1;
    }
    strncpy(dest, src, n);
    dest[n] = '\0';
    return EOK;
}

build/linux/compat/safec_lib_common.h:116

  • strcat_s returns an error on overflow, but unlike safeclib it does not clear dest. It also treats a non-NUL-terminated dest (within dmax) as an overflow case but still leaves the unterminated buffer intact. Clearing dest on these runtime-constraint violations better matches safeclib behavior and avoids callers accidentally using a partially valid/unterminated string.
static inline errno_t strcat_s(char *dest, rsize_t dmax, const char *src)
{
    size_t dlen;
    if (dest == NULL || src == NULL || dmax == 0) {
        return -1;
    }
    dlen = strnlen(dest, dmax);
    if (dlen + strlen(src) >= dmax) {
        return -1;
    }
    strcat(dest, src);
    return EOK;
}

build/linux/bpi/makefile:658

  • This comment line ends with a trailing \, which GNU make treats as a line-continuation before comment stripping. It currently happens to continue into another comment line, but it’s brittle and can accidentally comment-out the next non-comment line if edited later. Remove the trailing backslash.
# OneWifi/hostap objects are unaffected. Warnings flagged by -Wall and -Wextra stay visible, \

Copilot AI review requested due to automatic review settings August 5, 2026 17:33

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

Suppressed comments (1)

build/linux/bpi/makefile:658

  • This comment line ends with a trailing \, which in GNU make escapes the newline before parsing. Even though the next line is also a comment today, this can accidentally concatenate lines and cause confusing behavior if the surrounding lines change later. Remove the trailing backslash to keep the makefile parse unambiguous.
# OneWifi/hostap objects are unaffected. Warnings flagged by -Wall and -Wextra stay visible, \

Copilot AI review requested due to automatic review settings August 5, 2026 22: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 14 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (5)

source/db/wifi_db_apis.c:1939

  • sprintf() writes without a bound; even with a larger index buffer this is still an avoidable overflow risk. Prefer snprintf(index, sizeof(index), ...) so the conversion can’t overrun the stack buffer.

This issue also appears in the following locations of the same file:

  • line 6351
  • line 6442
  • line 6500
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",rfc_id);
    where = onewifi_ovsdb_tran_cond(OCLM_STR, "rfc_id", OFUNC_EQ, index);

source/db/wifi_db_apis.c:6447

  • sprintf() is unbounded. Switching to snprintf() avoids a potential stack overflow if advertisement_id formatting exceeds the buffer.
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);
    where = onewifi_ovsdb_tran_cond(OCLM_STR, "advertisement_id", OFUNC_EQ, index);

source/db/wifi_db_apis.c:6505

  • sprintf() is unbounded. Use snprintf() to guarantee the index buffer is not overrun when formatting advertisement_id.
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);
    where = onewifi_ovsdb_tran_cond(OCLM_STR, "advertisement_id", OFUNC_EQ, index);

source/db/wifi_db_apis.c:6362

  • sprintf() writes without a bound; use snprintf() to prevent potential overflow if the numeric ID is larger than expected.
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    if (rfc_param == NULL) {
        wifi_util_error_print(WIFI_DB, "%s:%d: rfc_param is NULL\n", __func__, __LINE__);
        return -1;
    }
    wifi_util_error_print(WIFI_DB, "%s:%d:rfc_param->link_quality_rfc =%d\n", __func__, __LINE__,rfc_param->link_quality_rfc);

    sprintf(index,"%d",rfc_id);
    where = onewifi_ovsdb_tran_cond(OCLM_STR, "rfc_id", OFUNC_EQ, index);

lib/common/os.c:167

  • The comment says this is a CI-only change, but the weak attribute is applied unconditionally in this library and will affect all builds. Update the comment to avoid misleading future readers about the scope/impact of making this symbol weak.
/* CI coverage build: added 'weak' attr so hostap's identical hwaddr_aton (linked via
 * libwifihal.a) wins instead of colliding; Nothing uses this copy directly. */
__attribute__((weak))

Copilot AI review requested due to automatic review settings August 5, 2026 23:56

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

Suppressed comments (5)

source/db/wifi_db_apis.c:1938

  • index is filled using sprintf(index, "%d", rfc_id), but rfc_id is UINT (unsigned) and %d is the wrong format specifier; also sprintf doesn’t enforce the destination buffer size. Use snprintf with %u to avoid UB and keep the write bounded.

This issue also appears on line 6351 of the same file.

    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",rfc_id);

source/db/wifi_db_apis.c:6351

  • index is populated with sprintf(index, "%d", rfc_id), but rfc_id is UINT (unsigned) and %d is the wrong format specifier; also sprintf is unbounded. Prefer snprintf with %u so the write is size-limited and the format matches the argument type.
    char index[12] = {0};

source/db/wifi_db_apis.c:6446

  • advertisement_id is UINT (unsigned), but sprintf(index, "%d", advertisement_id) uses %d and is unbounded. Use snprintf with %u to avoid UB and keep the write within index.

This issue also appears on line 6500 of the same file.

    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);

source/db/wifi_db_apis.c:6504

  • advertisement_id is UINT (unsigned), but sprintf(index, "%d", advertisement_id) uses %d and is unbounded. Switch to snprintf with %u so the conversion is type-correct and size-bounded.
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);

build/linux/compat/telemetry_busmessage_sender.h:34

  • t2_init is called with a string literal (e.g. t2_init("ccsp-wifi-agent")), so taking char* forces an unnecessary const-discard at call sites. Make the parameter const char * to match typical usage and avoid warnings when stricter flags are enabled.
static inline void t2_init(char* name) {

Copilot AI review requested due to automatic review settings August 6, 2026 07:45

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

Suppressed comments (8)

source/db/wifi_db_apis.c:6351

  • Same issue here: sprintf(index, "%d", rfc_id) uses a signed format for a UINT and is unbounded. Prefer snprintf with %u and sizeof(index) to avoid incorrect keys and potential overflows.
    char index[12] = {0};

source/db/wifi_db_apis.c:6442

  • advertisement_id is a UINT, but this uses %d and unbounded sprintf, which can produce wrong keys for large IDs. Use bounded snprintf with an unsigned format.
    char index[12] = {0};

source/db/wifi_db_apis.c:6500

  • advertisement_id is a UINT, but this uses %d and unbounded sprintf. Switch to snprintf with %u and sizeof(index) to prevent incorrect IDs and make the buffer size change actually enforce safety.
    char index[12] = {0};

source/db/wifi_db_apis.c:1938

  • sprintf(index, "%d", ...) is using a signed format for a UINT ID and is unbounded. If the ID exceeds INT_MAX this will format a negative value and generate an incorrect OVSDB key; sprintf also risks overflow if the typedef changes. Use snprintf with the correct unsigned format and sizeof(index).

This issue also appears in the following locations of the same file:

  • line 6351
  • line 6442
  • line 6500
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",rfc_id);

.github/workflows/makefile.yml:146

  • GitHub Actions workflow commands (::error::...) require escaping not only % but also carriage returns/newlines in the message. As-is, a \r (e.g. CRLF logs) can corrupt the annotation rendering. Escape \r/\n alongside % before emitting the command.
          printf '%s\n' "$errs" | head -10 | sed 's/%/%25/g' \
            | while IFS= read -r l; do echo "::error::$l"; done

build/linux/bpi/makefile:657

  • This comment line ends with a trailing \, which triggers Make's line-continuation behavior and will join with the next line before parsing. It currently happens to join another comment, but it's brittle and can accidentally comment-out or alter future edits. Remove the trailing backslash.
# OneWifi/hostap objects are unaffected. Warnings flagged by -Wall and -Wextra stay visible, \

build/linux/compat/safec_lib_common.h:102

  • strncpy_s currently truncates when n >= dmax and still returns EOK. That deviates from safeclib’s constraint-handling and can mask truncation bugs that would fail in real RDK builds (similar to what you already guarded against in sprintf_s). Consider treating n >= dmax as an error and clearing dest to better match safeclib behavior.
    if (n >= dmax) {
        n = dmax - 1;
    }
    strncpy(dest, src, n);
    dest[n] = '\0';

.github/workflows/makefile.yml:197

  • Same escaping issue for ::warning::... workflow commands: escape \r/\n (and %) to avoid malformed annotations when log lines contain CRLF or embedded control characters.
          printf '%s\n' "$found" | head -10 | sed 's/%/%25/g' \
            | while IFS= read -r l; do echo "::warning::$l"; done

Copilot AI review requested due to automatic review settings August 6, 2026 14:18

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

Suppressed comments (4)

source/db/wifi_db_apis.c:1938

  • rfc_id is a UINT, but the code formats it with %d and uses unbounded sprintf, which can trigger -Werror=format and is undefined behavior for mismatched types. Use snprintf with an unsigned format (or an explicit cast) to keep this safe under the new warning gating.

This issue also appears on line 6351 of the same file.

    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",rfc_id);

source/db/wifi_db_apis.c:6446

  • advertisement_id is a UINT, but this block formats it with %d in both the OVSDB key string and the log message. Under the new -Werror=format policy this will fail the build, and sprintf is unbounded. Use snprintf and an unsigned format (or cast) for the UINT.

This issue also appears on line 6500 of the same file.

    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);

source/db/wifi_db_apis.c:6504

  • advertisement_id is a UINT, but it is formatted with %d via sprintf. This is a format-type mismatch (undefined behavior) and can become a build failure under -Werror=format. Use bounded snprintf with an unsigned format/cast.
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);

source/db/wifi_db_apis.c:6351

  • rfc_id is a UINT, but this block formats it with %d in both the string key and the log message. With -Werror=format enabled for OneWifi sources, this is a build-breaking format-type mismatch. Also prefer bounded snprintf over sprintf.
    char index[12] = {0};

@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/OneWifi/1320/rdkb/components/opensource/ccsp/OneWifi

  • Commit: 2c733b6

Report detail: gist'

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

Suppressed comments (7)

source/db/wifi_db_apis.c:1938

  • rfc_id is a UINT, but this builds the index string with sprintf(index, "%d", rfc_id), which uses the wrong format specifier for an unsigned type and has no bounds check. This can mis-format values > INT_MAX and is avoidable since you already size the buffer for the decimal representation.

This issue also appears on line 6351 of the same file.

    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",rfc_id);

source/db/wifi_db_apis.c:6351

  • rfc_id is a UINT, but the index string is still built with sprintf(index, "%d", rfc_id) (signed format + no bounds). Use snprintf with %u so the value is formatted correctly and bounded by the index buffer size.
    char index[12] = {0};

source/db/wifi_db_apis.c:6446

  • advertisement_id is a UINT, but this uses sprintf(index, "%d", advertisement_id) (signed format + unbounded write). Use snprintf with %u to avoid UB for values > INT_MAX and keep the write bounded.

This issue also appears on line 6500 of the same file.

    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);

source/db/wifi_db_apis.c:6504

  • advertisement_id is a UINT, but this uses sprintf(index, "%d", advertisement_id) (signed format + no bounds). Prefer snprintf with %u so the output is correct and bounded by the buffer size.
    char index[12] = {0};
    wifi_db_t *g_wifidb;
    g_wifidb = (wifi_db_t*) get_wifidb_obj();

    sprintf(index,"%d",advertisement_id);

build/linux/compat/telemetry_busmessage_sender.h:25

  • This header is described as being for “unit test simulation”, but it’s being added under build/linux/compat and used as a CI coverage-build compatibility shim. The comment (and the “unit test” wording below) is misleading for future maintainers.
/*
 * Mock header for unit test simulation of telemetry_busmessage_sender.h
 */

build/linux/compat/secure_wrapper.h:30

  • The comment says this file “must never be pushed”, but it’s now part of this repository. If the intent is “not part of upstream RDK / only for CI linux coverage builds”, please reword so the guidance is actionable in this repo context.
 * This file is NOT upstream and must never be pushed; it lives under
 * build/linux/compat and is only on the include path for the coverage builds.

.github/workflows/clang-format.yml:29

  • Typo in the comment: “merege commit” → “merge commit”.
          # For pull_request events actions/checkout defaults to the merege commit

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.

4 participants