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 fixes for pkg_editor_test.cpp #291

Merged
merged 1 commit into from
May 8, 2023

Conversation

tylerzhao7684
Copy link
Contributor

Fixed the following coverity issues:

  • Adding assert to make sure the result is nullptr before returning in TEST(create, bad_flags)
  • Change strncmp(buf, file1, strlen(file0) to strncmp(buf, file1, strlen(file1) to avoid copy paste error in TEST(sample_file, update_same_size)
  • Add assert(fd > 0) and assert(old_stdin > 0) to make sure positive parameter is passed to dup() and dup2() in TEST(package, unpack_buffer_stdin)

@tylerzhao7684 tylerzhao7684 requested a review from zibaiwan May 3, 2023 14:25
@intel intel deleted a comment from tylerzhao7684 May 4, 2023
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tylerzhao7684 . The code change looks good to me. Two nitpicks.

  1. Can you squash the two commits into 1 commit? You can use rebase/reset to do it, then you need a force push. The reason is the Runtime repo doesn't squash the commits into the main branch once merge, instead we allow multiple commits as it would be beneficial in some scenarios where the PR does a few different things to make the reading easier or make the later cherry-picking/revert easier. In this specific PR, 1 commit is good.

  2. Can you change the commit message body (currently body is None) to include the good information that you posted in the PR? So the commit itself will have all the info you posted in the PR, since the PR info could be lost, especially in the upstream.

Fixed the following coverity issues:
- Adding assert to make sure the result is nullptr before returning in TEST(create, bad_flags)
- Change strncmp(buf, file1, strlen(file0) to strncmp(buf, file1, strlen(file1) to avoid copy paste error in TEST(sample_file, update_same_size)
- Add assert(fd > 0) and assert(old_stdin > 0) to make sure positive parameter is passed to dup() and dup2() in TEST(package, unpack_buffer_stdin)
@zibaiwan zibaiwan merged commit 2ee41a5 into intel:main May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants