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 :215255] Dereference before null check in tests/subsys/fs/fs_api/src/test_fs.c #29704

Closed
zephyrbot opened this issue Nov 2, 2020 · 0 comments · Fixed by #29738
Assignees
Labels
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

@zephyrbot
Copy link
Collaborator

Static code scan issues found in file:

https://github.com/zephyrproject-rtos/zephyr/tree/c9a2a5e7fb0194bfb168f5aa1a0a83c73f62acb3/tests/subsys/fs/fs_api/src/test_fs.c#L300

Category: Null pointer dereferences
Function: temp_mount
Component: Tests
CID: 215255

Details:

294     }
295    
296     static int temp_mount(struct fs_mount_t *mountp)
297     {
298         size_t len = strlen(mountp->mnt_point);
299    
>>>     CID 215255:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "mountp" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
300         if (mountp == NULL) {
301             return -EINVAL;
302         }
303    
304         if (mountp->mnt_point[len - 1] != ':') {
305             return -EINVAL;

Please fix or provide comments in coverity using the link:

https://scan9.coverity.com/reports.htm#v32951/p12996.

Note: This issue was created automatically. Priority was set based on classification
of the file affected and the impact field in coverity. Assignees were set using the CODEOWNERS file.

@zephyrbot zephyrbot added 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 labels Nov 2, 2020
megatherium-95 added a commit to megatherium-95/zephyr that referenced this issue Nov 5, 2020
Before referencing mountp argument, check for it's NULLness

Fixes zephyrproject-rtos#29704

Signed-off-by: iva kik <[email protected]>
MaureenHelm pushed a commit that referenced this issue Nov 17, 2020
Before referencing mountp argument, check for it's NULLness

Fixes #29704

Signed-off-by: iva kik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

Successfully merging a pull request may close this issue.

2 participants