-
Notifications
You must be signed in to change notification settings - Fork 35
Fix for static analysis issues #35
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
base: v2.4.115
Are you sure you want to change the base?
Conversation
f8898d2 to
3b98e1f
Compare
libsync.h
Outdated
| int ret; | ||
|
|
||
| data.fd2 = fd2; | ||
| strncpy(data.name, name, sizeof(data.name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the copy be guarded against the length of name like this:
if (sizeof(data.name) < strlen(name)) {
strncpy(data.name, name, sizeof(data.name));
data.name[sizeof(data.name) - 1] = '\0';
} else {
strncpy(data.name, name, strlen(name) - 1);
data.name[strlen(name)] = '\0';
}
3b98e1f to
f6d5edf
Compare
akodanka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
intel/intel_bufmgr_gem.c
Outdated
| assert(pgsz > 0); | ||
|
|
||
| if (pgsz < 0) | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add indentation space before return false
intel/intel_decode.c
Outdated
| } | ||
| return ""; | ||
| // Adding an assertion to indicate that this point should never be reached. | ||
| __builtin_unreachable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check for indentation
xf86drm.c
Outdated
| chown_check_return(buf, user, group); | ||
| chmod(buf, devmode); | ||
| if (chmod(buf, devmode) != 0) | ||
| return errno; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space before return errno
xf86drm.c
Outdated
| chown_check_return(buf, user, group); | ||
| chmod(buf, devmode); | ||
| if (chmod(buf, devmode) != 0) | ||
| return errno; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space before return errno
intel/intel_decode.c
Outdated
| if (!gen) | ||
| return NULL; | ||
| // LOGICALLY_DEAD_CODE: As the value of gen can't be 0. | ||
| //if (!gen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove these lines
Below are the issues fixed: - Buffer not null terminated - Resource leak - Logically dead code - Argument cannot be negative - Dead default in switch - Dereference after null check - Unchecked return value - Data race condition - Unchecked return value from library Tracked-On: OAM-122340 Signed-off-by: Sapna <[email protected]>
f6d5edf to
e9f3e86
Compare
|
These coverity issues are related upstream code, then we can directly get waiver for them, don't need fix actually. If we need fix them, it is better directly submit to upstream repo. |
Below are the issues fixed:
Tracked-On: OAM-122340