Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions source/bulkdata/profile.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in source/bulkdata/profile.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/bulkdata/profile.c' (Match: rdk/components/generic/telemetry/rdk/components/generic/telemetry/1, 1543 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/telemetry/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/bulkdata/profile.c)

Check failure on line 3 in source/bulkdata/profile.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/bulkdata/profile.c' (Match: rdk/components/generic/telemetry/rdk/components/generic/telemetry/2102, 1543 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/telemetry/+archive/rdk-dev-2102.tar.gz, file: source/bulkdata/profile.c)
*
* Copyright 2019 RDK Management
*
Expand Down Expand Up @@ -349,8 +349,7 @@
struct timespec endTime;
struct timespec elapsedTime;
char* customLogPath = NULL;


int clockReturn = 0;

T2ERROR ret = T2ERROR_FAILURE;
if( profile->name == NULL || profile->encodingType == NULL || profile->protocol == NULL )
Expand All @@ -374,7 +373,7 @@
T2Info("%s ++in profileName : %s\n", __FUNCTION__, profile->name);


clock_gettime(CLOCK_REALTIME, &startTime);
clockReturn = clock_gettime(CLOCK_MONOTONIC, &startTime);
if( !strcmp(profile->encodingType, "JSON") || !strcmp(profile->encodingType, "MessagePack"))
{
JSONEncoding *jsonEncoding = profile->jsonEncoding;
Expand Down Expand Up @@ -749,9 +748,16 @@
{
T2Error("Unsupported encoding format : %s\n", profile->encodingType);
}
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 24, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

clock_gettime(CLOCK_REALTIME, &endTime);
getLapsedTime(&elapsedTime, &endTime, &startTime);
T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long )elapsedTime.tv_sec, elapsedTime.tv_nsec);
clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime);
if(clockReturn)
{
T2Warning("Error in Fetching the time Elapsed");
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The error message "Error in Fetching the time Elapsed" is grammatically incorrect and unclear. Consider revising to "Error fetching elapsed time" or "Failed to get time from clock_gettime()" to be more concise and accurate.

Suggested change
T2Warning("Error in Fetching the time Elapsed");
T2Warning("Failed to get time from clock_gettime()");

Copilot uses AI. Check for mistakes.
}
else
{
getLapsedTime(&elapsedTime, &endTime, &startTime);
T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long )elapsedTime.tv_sec, elapsedTime.tv_nsec);
}
if(ret == T2ERROR_SUCCESS && jsonReport)
{
free(jsonReport);
Expand Down
32 changes: 24 additions & 8 deletions source/bulkdata/profilexconf.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in source/bulkdata/profilexconf.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/bulkdata/profilexconf.c' (Match: rdk/components/generic/telemetry/rdk/components/generic/telemetry/1, 1023 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/telemetry/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/bulkdata/profilexconf.c)
*
* Copyright 2019 RDK Management
*
Expand Down Expand Up @@ -247,8 +247,8 @@
T2Info("%s ++in profileName : %s\n", __FUNCTION__, profile->name);
}


clock_gettime(CLOCK_REALTIME, &startTime);
int clockReturn = 0;
clockReturn = clock_gettime(CLOCK_MONOTONIC, &startTime);
Comment on lines +250 to +251
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The return value of the first clock_gettime call is not checked. If the first call fails, clockReturn will be non-zero, but the code continues execution. This could lead to using uninitialized startTime values in later calculations. Consider checking the return value immediately after the first call or initializing clockReturn to ensure both calls are checked properly.

Copilot uses AI. Check for mistakes.
if(profile->encodingType != NULL && !strcmp(profile->encodingType, "JSON"))
{
if(T2ERROR_SUCCESS != initJSONReportXconf(&profile->jsonReportObj, &valArray))
Expand Down Expand Up @@ -304,13 +304,21 @@
encodeEventMarkersInJSON(valArray, profile->eMarkerList);
}
profile->grepSeekProfile->execCounter += 1;
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

T2Info("Execution Count = %d\n", profile->grepSeekProfile->execCounter);
T2Info("Xconf Profile Execution Count = %d\n", profile->grepSeekProfile->execCounter);

ret = prepareJSONReport(profile->jsonReportObj, &jsonReport);
destroyJSONReport(profile->jsonReportObj);
profile->jsonReportObj = NULL;
clock_gettime(CLOCK_REALTIME, &endTime);
T2Info("Processing time for profile %s is %ld seconds\n", profile->name, (long)(endTime.tv_sec - startTime.tv_sec));
clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime);
if(clockReturn)
{
T2Warning("Error in Fetching the time Elapsed");
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The error message "Error in Fetching the time Elapsed" is grammatically incorrect and unclear. Consider revising to "Error fetching elapsed time" or "Failed to get time from clock_gettime()" to be more concise and accurate.

Suggested change
T2Warning("Error in Fetching the time Elapsed");
T2Warning("Failed to get time from clock_gettime()");

Copilot uses AI. Check for mistakes.
}
else
{
T2Info("%s Xconf Profile Processing Time in seconds : %ld\n", profile->name, (long)(endTime.tv_sec - startTime.tv_sec));
}

if(ret != T2ERROR_SUCCESS)
{
T2Error("Unable to generate report for : %s\n", profile->name);
Expand Down Expand Up @@ -451,9 +459,17 @@
T2Warning("Failed to save grep config to file for profile: %s\n", profile->name);
}
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

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

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

#endif
clock_gettime(CLOCK_REALTIME, &endTime);
getLapsedTime(&elapsedTime, &endTime, &startTime);
T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long)elapsedTime.tv_sec, elapsedTime.tv_nsec);
clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime);
if (clockReturn)
{
T2Warning("Error in Fetching the time Elapsed");
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The error message "Error in Fetching the time Elapsed" is grammatically incorrect and unclear. Consider revising to "Error fetching elapsed time" or "Failed to get time from clock_gettime()" to be more concise and accurate.

Suggested change
T2Warning("Error in Fetching the time Elapsed");
T2Warning("Failed to get time from clock_gettime()");

Copilot uses AI. Check for mistakes.
}
else
{
getLapsedTime(&elapsedTime, &endTime, &startTime);
T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long)elapsedTime.tv_sec, elapsedTime.tv_nsec);
}

if(jsonReport)
{
free(jsonReport);
Expand Down
Loading