Skip to content

[Coverity CID :197611]Integer handling issues in /lib/os/printk.c #15393

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

Closed
aasthagr opened this issue Apr 12, 2019 · 2 comments
Closed

[Coverity CID :197611]Integer handling issues in /lib/os/printk.c #15393

aasthagr opened this issue Apr 12, 2019 · 2 comments
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

@aasthagr
Copy link
Collaborator

Static code scan issues seen in File: /lib/os/printk.c
Category: Integer handling issues
Function: z_vprintk
Component: Other
CID: 197611
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: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels Apr 12, 2019
@aasthagr
Copy link
Collaborator Author

aasthagr commented Apr 12, 2019

*** CID 197611:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/lib/os/printk.c: 166 in z_vprintk()
160     s32_t d;
161     
162     if (long_ctr == 0) {
163     d = va_arg(ap, int);
164     } else if (long_ctr == 1) {
165     long ld = va_arg(ap, long);
>>>     CID 197611:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
>>>     "ld > 2147483647" is always false regardless of the values of its operands. This occurs as the logical first operand of "||".
166     if (ld > INT32_MAX || ld < INT32_MIN) {
167     print_err(out, ctx);
168     break;
169     }
170     d = (s32_t)ld;
171     } else {

@nashif nashif added priority: low Low impact/importance bug priority: medium Medium impact/importance bug and removed priority: low Low impact/importance bug labels Apr 12, 2019
@galak
Copy link
Collaborator

galak commented Apr 12, 2019

This is a duplicate of 13843, Coverity triggered due to:

commit 4aa4883 (upstream/topic-sensors)
Author: Patrik Flykt [email protected]
Date: Thu Mar 14 19:42:51 2019 -0600

subsystems: Rename reserved function names

@galak galak closed this as completed Apr 12, 2019
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

3 participants