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

Missing checks of return values of settings_runtime_set() #30191

Closed
Hxinrong opened this issue Nov 23, 2020 · 0 comments · Fixed by #30652
Closed

Missing checks of return values of settings_runtime_set() #30191

Hxinrong opened this issue Nov 23, 2020 · 0 comments · Fixed by #30652
Labels
area: Bluetooth area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@Hxinrong
Copy link
Contributor

Hello,
As shown in the API documentation, function settings_runtime_set() is used to set a value with a specific key to a module handler, returns 0 on success, non-zero on failure. But in the following codes, the return values are not error checked.

svn = 0x1234;
settings_runtime_set("bt/ctlr/subver", &svn, sizeof(svn));
zassert_equal(ll_settings_subversion_number(), svn,
"Subversion number does not match");
svn = 0x5678;
settings_runtime_set("bt/ctlr/subver", &svn, sizeof(svn));
zassert_equal(ll_settings_subversion_number(), svn,
"Subversion number does not match");

However, in the same file, the return values of the following call sites are checked, which have the same code structure.

cid = 0x1234;
err = settings_runtime_set("bt/ctlr/company", &cid, sizeof(cid));
zassert_equal(err, 0, "Setting Company Id failed");
zassert_equal(ll_settings_company_id(), cid,
"Company Id does not match");
cid = 0x5678;
err = settings_runtime_set("bt/ctlr/company", &cid, sizeof(cid));
zassert_equal(err, 0, "Changing Company Id failed");
zassert_equal(ll_settings_company_id(), cid,
"Company ID does not match");

@Hxinrong Hxinrong added the bug The issue is a bug, or the PR is fixing a bug label Nov 23, 2020
@de-nordic de-nordic added area: Settings Settings subsystem area: Tests Issues related to a particular existing or missing test area: Bluetooth and removed area: Settings Settings subsystem labels Nov 23, 2020
@nashif nashif added the priority: low Low impact/importance bug label Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants