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 :203623]Memory - illegal accesses in /tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c #18687

Closed
aasthagr opened this issue Aug 26, 2019 · 1 comment · Fixed by #18779
Assignees
Labels
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
Milestone

Comments

@aasthagr
Copy link
Collaborator

Static code scan issues seen in File: /tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c
Category: Memory - illegal accesses
Function: test_prepare_storage
Component: Tests
CID: 203623
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 26, 2019
@aasthagr
Copy link
Collaborator Author

*** CID 203623:  Memory - illegal accesses  (NO_EFFECT)
/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c: 109 in test_prepare_storage()
103     
104     		dev = flash_area_get_device(fa);
105     
106     		err = flash_write_protection_set(dev, false);
107     		zassert_true(err == 0, "can't unprotect flash");
108     
>>>     CID 203623:  Memory - illegal accesses  (NO_EFFECT)
>>>     Argument "-256" in "memset" loses precision in "memset(new_val, -256, 4U)".
109     		(void)memset(new_val, ~ERASED_VAL, DT_FLASH_WRITE_BLOCK_SIZE);
110     		err = flash_write(dev, (off_t)&prepared_mark, &new_val,
111     				  sizeof(new_val));
112     		zassert_true(err == 0, "can't write prepared_mark");
113     	}
114     #else

@rljordan-zz rljordan-zz added this to the v2.0.0 milestone Aug 27, 2019
@rljordan-zz rljordan-zz added the priority: low Low impact/importance bug label Aug 27, 2019
carlescufi added a commit to carlescufi/zephyr that referenced this issue Aug 29, 2019
Mask the value passed to memset() to avoid an error from Coverity.

Fixes zephyrproject-rtos#18687.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
carlescufi added a commit that referenced this issue Aug 30, 2019
Mask the value passed to memset() to avoid an error from Coverity.

Fixes #18687.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
LeiW000 pushed a commit to LeiW000/zephyr that referenced this issue Sep 2, 2019
Mask the value passed to memset() to avoid an error from Coverity.

Fixes zephyrproject-rtos#18687.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

Successfully merging a pull request may close this issue.

4 participants