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: 182193] Control flow issues in /subsys/storage/flash_map/flash_map.c #5739

Closed
Shilpashree3lc-zz opened this issue Jan 19, 2018 · 2 comments
Assignees
Labels
area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug

Comments

@Shilpashree3lc-zz
Copy link
Contributor

Static code scan issues seen in File: /subsys/storage/flash_map/flash_map.c
Category: Control flow issues
Function: get_flah_dev_from_id
Component: Other
CID: 182193
Please fix or provide comments to square it off in coverity in the link: https://scan9.coverity.com/reports.htm#v32951/p12996

@Shilpashree3lc-zz Shilpashree3lc-zz added area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels Jan 19, 2018
@nashif nashif added the priority: medium Medium impact/importance bug label Feb 6, 2018
@Shilpashree3lc-zz
Copy link
Contributor Author

Shilpashree3lc-zz commented Mar 6, 2018

*** CID 182193:  Control flow issues  (NO_EFFECT)
/subsys/storage/flash_map/flash_map.c: 74 in get_flah_dev_from_id()
68     {
69     	/* nothing to do for now */
70     }
71     
72     static struct device *get_flah_dev_from_id(u8_t id)
73     {
>>>     CID 182193:  Control flow issues  (NO_EFFECT)
>>>     "i" is converted to an unsigned type because it's compared to an unsigned constant.

74     	for (int i = 0; i < ARRAY_SIZE(flash_drivers_map); i++) {
75     		if (flash_drivers_map[i].id == id) {
76     			return flash_dev[i];
77     		}
78     	}
79     

@carlescufi
Copy link
Member

@nvlsianpu can you use unsigned int here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants