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

More of static analysis fixes #1496

Merged
merged 1 commit into from Nov 25, 2019
Merged

More of static analysis fixes #1496

merged 1 commit into from Nov 25, 2019

Conversation

JanuszL
Copy link
Contributor

@JanuszL JanuszL commented Nov 22, 2019

  • fixes:
  • lack of null-terminated buffers
  • uninitialized variables
  • replaces throw from the constructor to explicit terminate

Signed-off-by: Janusz Lisiecki jlisiecki@nvidia.com

Why we need this PR?

  • fixes issues reported by the coverity

What happened in this PR?

  • tested in CI
  • fixes:
  • lack of null-terminated buffers
  • uninitialized variables
  • replaces throw from the constructor to explicit terminate

JIRA TASK: [DALI-1094]

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1003318]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1003318]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1003318]: BUILD PASSED

- fixes:
 - lack of null-terminated buffers
 - uninitialized variables
 - replaces throw from the constructor to explicit terminate

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1003495]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [1003495]: BUILD PASSED

@klecki
Copy link
Contributor

klecki commented Nov 25, 2019

I still feel like this pattern is a bit counterproductive:

  static void Deallocate(void *ptr, int device) noexcept {
    DeviceGuard guard(device);
    try {
      DeviceGuard guard(device);
    } catch (...) {
      std::terminate();
    }

It's a bit like:

if (ptr != nullptr) {
	delete ptr;
} else {
 ; // No-op
}

@JanuszL
Copy link
Contributor Author

JanuszL commented Nov 25, 2019

I still feel like this pattern is a bit counterproductive:

  static void Deallocate(void *ptr, int device) noexcept {
    DeviceGuard guard(device);
    try {
      DeviceGuard guard(device);
    } catch (...) {
      std::terminate();
    }

It's a bit like:

if (ptr != nullptr) {
	delete ptr;
} else {
 ; // No-op
}

My non-expert point of view is that someone may not expect that DeviceGuard throws and calling Deallocate may end up with the terminate. By making it explicit no one is surprised.

@JanuszL JanuszL merged commit fe65df0 into NVIDIA:master Nov 25, 2019
@JanuszL JanuszL deleted the cov_fixed branch November 25, 2019 13:07
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.

None yet

5 participants