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

Commits on May 12, 2021

  1. tests: logging: log_api: Use positive CONFIG_LOG_BUFFER_SIZE

    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 <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    d470b77 View commit details
    Browse the repository at this point in the history
  2. lib: os: cbprintf: Fix incompatible case coverity issue

    Coverity (CID 235987) complained about casting from double *
    to int *.
    
    Signed-off-by: Krzysztof Chruscinski <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    c8c50bd View commit details
    Browse the repository at this point in the history
  3. tests: logging: log_api: Remove accidental early return

    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 <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fe7a6bf View commit details
    Browse the repository at this point in the history
  4. logging: Add missing va_end in log_msg2

    Added missing va_end. Reported by coverity CID 232501
    
    Signed-off-by: Krzysztof Chruscinski <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    70497e4 View commit details
    Browse the repository at this point in the history
  5. tests: logging: log_msg2: Prevent using negative array index

    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 <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    fb8c2f8 View commit details
    Browse the repository at this point in the history
  6. tests: logging: log_api: Prevent negative array index write

    Coverity CID 235911.
    
    Signed-off-by: Krzysztof Chruscinski <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    df19140 View commit details
    Browse the repository at this point in the history
  7. tests: logging: log_api: Fix in mock backend

    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 <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    dab1e92 View commit details
    Browse the repository at this point in the history
  8. lib: os: cbprintf: Avoid implicit casting to int *

    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 <[email protected]>
    nordic-krch committed May 12, 2021
    Configuration menu
    Copy the full SHA
    484b401 View commit details
    Browse the repository at this point in the history