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

Fix coverity issues #4349

Merged
merged 2 commits into from
Oct 14, 2022
Merged

Conversation

banasraf
Copy link
Collaborator

@banasraf banasraf commented Oct 13, 2022

Signed-off-by: Rafal rbanas@nvidia.com

Category:

Bug fix

Description:

It fixes issues found by coverity

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

Signed-off-by: Rafal <rbanas@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6171593]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6171593]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6180197]: BUILD STARTED

@banasraf banasraf marked this pull request as ready for review October 14, 2022 09:29
Comment on lines 29 to 30
DALI_ENFORCE(in_layout.find('H') >= 0 && in_layout.find('W') >= 0,
"Input layout has to contain at least H and W dimensions.");
Copy link
Contributor

@mzient mzient Oct 14, 2022

Choose a reason for hiding this comment

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

Nitpick: technically, there's no such requirement for the input layout (it could be **C or whatever).

Comment on lines 31 to 32
DALI_ENFORCE(out_layout.find('H') >= 0 && out_layout.find('W') >= 0,
"Output layout has to contain at least H and W dimensions.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess at this point it should be:

Suggested change
DALI_ENFORCE(out_layout.find('H') >= 0 && out_layout.find('W') >= 0,
"Output layout has to contain at least H and W dimensions.");
int h_dim = ImageLayoutInfo::DimIndex(out_layout, 'H');
int w_dim = ImageLayoutInfo::DimIndex(out_layout, 'W');
DALI_ENFORCE(h_dim >= 0 && w_dim >= 0,
"Output layout has to contain at least H and W dimensions.");

...and you could remove the

      auto h_dim = ImageLayoutInfo::DimIndex(out_layout, 'H');
      auto w_dim = ImageLayoutInfo::DimIndex(out_layout, 'W');

from the TYPE_SWITCH below.

@mzient mzient self-assigned this Oct 14, 2022
Copy link
Contributor

@mzient mzient left a comment

Choose a reason for hiding this comment

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

LGTM, with some minor remarks

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6180197]: BUILD PASSED

Signed-off-by: Rafal <rbanas@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6181826]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6181826]: BUILD PASSED

@banasraf banasraf merged commit f4565c4 into NVIDIA:main Oct 14, 2022
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

4 participants