-
Notifications
You must be signed in to change notification settings - Fork 609
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 unchecked CUDA API calls in utility functions #2517
Conversation
16512016, 16512037, 16512220, 16512041 Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
5f7a74b
to
738e69d
Compare
!build |
CI MESSAGE: [1864225]: BUILD STARTED |
CI MESSAGE: [1864225]: BUILD FAILED |
dali/operators/audio/mfcc/mfcc.cu
Outdated
@@ -69,7 +69,7 @@ bool MFCC<GPUBackend>::SetupImpl(std::vector<OutputDesc> &output_desc, | |||
output_desc = detail::SetupKernel<T>(kmgr_, ctx_, input, make_cspan(args_), axis_); | |||
), DALI_FAIL(make_string("Unsupported data type: ", input.type().id()))); // NOLINT | |||
int64_t max_ndct = 0; | |||
for (int i = 0; i < nsamples_; ++i) { | |||
for (int i = 0; i < input.ntensor(); ++i) { |
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.
In such instances we should always take the output size, not the input.
Rationale: if we use output size, all we risk is reading garbage or illegal read; if we use input size, we run the risk of corrupting memory and the function becomes a potential attack route.
!build |
CI MESSAGE: [1865197]: BUILD STARTED |
CI MESSAGE: [1865197]: BUILD PASSED |
@@ -69,7 +69,7 @@ bool MFCC<GPUBackend>::SetupImpl(std::vector<OutputDesc> &output_desc, | |||
output_desc = detail::SetupKernel<T>(kmgr_, ctx_, input, make_cspan(args_), axis_); | |||
), DALI_FAIL(make_string("Unsupported data type: ", input.type().id()))); // NOLINT | |||
int64_t max_ndct = 0; | |||
for (int i = 0; i < nsamples_; ++i) { | |||
for (int i = 0; i < output_desc[0].shape.num_samples(); ++i) { |
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.
why this change?
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.
I removed the member field, the coverity was complaining that it is not initialized, and I didn't see it in @szalpal PR, so decided to go with the flow of the rework.
16512016, 16512037, 16512220, 16512041, ....
Signed-off-by: Krzysztof Lecki klecki@nvidia.com
Why we need this PR?
Sprinkle the utility functions with CUDA_CALL(...);
What happened in this PR?
only utils, the
*_test.*
andoperators/**
are checked already andkernels/**
are the responsibility of the userNA
CI
NO
JIRA TASK: [Use DALI-1724 or NA]