Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coverity issues in cbprintf and logging #35201

Merged
merged 8 commits into from
May 13, 2021

Conversation

nordic-krch
Copy link
Contributor

Set of fixes in cbprintf/logging code and tests.

Fixes #35116.
Fixes #35126.
Fixes #35127.
Fixes #35152.
Fixes #35153.
Fixes #35133.
Fixes #35134.
Fixes #35135.
Fixes #35148.
Fixes #35151.

When immediate mode is used CONFIG_LOG_BUFFER_SIZE is not defined
in kconfig. For proper compilation it is then defined in the test
file. Use positive value to please coverity which complains about
dead code when it is set to 0. Fixing CID 235961, 235965.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Coverity (CID 235987) complained about casting from double *
to int *.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
@github-actions github-actions bot added area: API Changes to public APIs area: Logging area: Tests Issues related to a particular existing or missing test labels May 12, 2021
There was an accidental early return in the test. Spotted by
coverity CID 235986, 236006.

Additionally, test had to be fixed because early returned covered
issues.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added missing va_end. Reported by coverity CID 232501

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Move assert check before array access to ensure that
negative index is not used in an array. Coverity CID 222151.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Coverity CID 235911.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Mock backend is using 32 bytes for hexdump data and
only hexdumps with less data shall be compared against
expected one. Wrong operator was used and comparing
was performed only when hexdump size exceeded 32 bytes.
Spotted by Coverity CID 236015.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Arg can be double * and it is casted to int *. Coverity reports
it (CID 235943). Fixed by adding intermediate void * variable.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
@galak galak merged commit f8ac3a4 into zephyrproject-rtos:master May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Base OS Base OS Library (lib/os) area: Logging area: Tests Issues related to a particular existing or missing test
Projects
None yet
6 participants