Fix for static analysis issues#35
Open
Sapna1-singh wants to merge 1 commit intoprojectceladon:v2.4.115from
Open
Fix for static analysis issues#35Sapna1-singh wants to merge 1 commit intoprojectceladon:v2.4.115from
Sapna1-singh wants to merge 1 commit intoprojectceladon:v2.4.115from
Conversation
f8898d2 to
3b98e1f
Compare
akodanka
reviewed
Jul 29, 2024
libsync.h
Outdated
| @@ -91,6 +91,11 @@ static inline int sync_merge(const char *name, int fd1, int fd2) | |||
| data.fd2 = fd2; | |||
| strncpy(data.name, name, sizeof(data.name)); | |||
There was a problem hiding this comment.
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
intel/intel_bufmgr_gem.c
Outdated
| assert(pgsz > 0); | ||
|
|
||
| if (pgsz < 0) | ||
| return false; |
There was a problem hiding this comment.
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(); |
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.
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.
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.
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 <sapna1.singh@intel.com>
f6d5edf to
e9f3e86
Compare
JaikrishnaNemallapudi
approved these changes
Aug 1, 2024
akodanka
approved these changes
Aug 1, 2024
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Below are the issues fixed:
Tracked-On: OAM-122340