Skip to content

[SYCL][NFC] Fix static code analysis concerns #4932

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

Merged
merged 3 commits into from
Nov 12, 2021

Conversation

smanna12
Copy link
Contributor

@smanna12 smanna12 commented Nov 10, 2021

Found via a static-analysis tool:
Pointer may be dereferenced after it was positively checked for NULL

Inside GenerateCode() function:

if (FD->isInlineBuiltinDeclaration() && Fn) {} ----> Pointer 'Fn' checked for NULL here

if (SyclOptReport.HasOptReportInfo(FD)) {
llvm::OptimizationRemarkEmitter ORE(Fn); ---> Pointer 'Fn' is dereferenced by passing argument 1 to function "OptimizationRemarkEmitter"

This patch checks Pointer 'Fn' inside routine to resolve the bug.

Signed-off-by: Soumi Manna [email protected]

@smanna12 smanna12 changed the title SYCL][NFC] Fix static code analysis concerns [SYCL][NFC] Fix static code analysis concerns Nov 10, 2021
@smanna12 smanna12 marked this pull request as ready for review November 10, 2021 16:33
@smanna12 smanna12 requested a review from erichkeane November 10, 2021 17:36
Copy link
Contributor

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@smanna12
Copy link
Contributor Author

Thank you everyone for the reviews.

@smanna12
Copy link
Contributor Author

This PR is ready. @dm-vodopyanov could you merge it? Thanks.

@dm-vodopyanov dm-vodopyanov merged commit 2675499 into intel:sycl Nov 12, 2021
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.

5 participants