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

[Coverity CID :203400]Integer handling issues in /tests/lib/fdtable/src/main.c #18447

Closed
aasthagr opened this issue Aug 17, 2019 · 2 comments
Closed
Assignees
Labels
area: Security Security area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: low Low impact/importance bug

Comments

@aasthagr
Copy link
Collaborator

Static code scan issues seen in File: /tests/lib/fdtable/src/main.c
Category: Integer handling issues
Function: test_z_finalize_fd
Component: Tests
CID: 203400
Please fix or provide comments to square it off in coverity in the link: https://scan9.coverity.com/reports.htm#v32951/p12996

@aasthagr aasthagr added area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels Aug 17, 2019
@galak galak added the priority: low Low impact/importance bug label Aug 18, 2019
@applejax124 applejax124 removed their assignment Oct 29, 2019
@aescolar
Copy link
Member

f1afb4c

 62void test_z_finalize_fd(void)
 63{
 64        const struct fd_op_vtable *vtable;
 65
   	1. negative_return_fn: Function z_reserve_fd() returns a negative number. [show details]
   	2. assign: Assigning: fd = z_reserve_fd().
 66        int fd = z_reserve_fd();
 67        int *obj = z_get_fd_obj_and_vtable(fd, &vtable);
 68
 69        const struct fd_op_vtable *original_vtable = vtable;
 70        int *original_obj = obj;
 71
   	
CID 203400 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)
3. negative_returns: fd is passed to a parameter that cannot be negative. [show details]
 72        z_finalize_fd(fd, obj, vtable); /* function being tested */
 73
 74        obj = z_get_fd_obj_and_vtable(fd, &vtable);
 75
 76        zassert_equal_ptr(obj, original_obj, "obj is different after finalizing");
 77        zassert_equal_ptr(vtable, original_vtable, "vtable is different after finalizing");
 78
 79        z_free_fd(fd);
 80}

@nashif nashif self-assigned this Nov 29, 2019
@d3zd3z d3zd3z added the area: Security Security label Dec 5, 2019
@nashif
Copy link
Member

nashif commented Dec 10, 2019

was fixed in afe5b25

@nashif nashif closed this as completed Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Security Security area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

6 participants