Skip to content

Comments

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

Merged
bader merged 1 commit intointel:syclfrom
smanna12:KW_BUG
Dec 21, 2021
Merged

[SYCL][NFC] Fix static code analysis concerns#5189
bader merged 1 commit intointel:syclfrom
smanna12:KW_BUG

Conversation

@smanna12
Copy link
Contributor

Found via a static-analysis tool:
Suspicious dereference of pointer in function call before NULL check

Inside checkAllowedSYCLInitializer() in SemaSYCL.cpp file:

const Expr *Init = VD->getInit();
bool ValueDependent = Init->isValueDependent(); --> 'Init' is dereferenced by being passed as argument 0 to function "isValueDependent
bool isConstantInit =
   Init && !ValueDependent && Init->isConstantInitializer(Context, false);  --> 'Init' is checked for NULL here

This patch adds NULL value checking for 'Init' expression.

Signed-off-by: Soumi Manna soumi.manna@intel.com

Found via a static-analysis tool:
Suspicious dereference of pointer in function call before NULL check

Inside checkAllowedSYCLInitializer() in SemaSYCL.cpp file:

    const Expr *Init = VD->getInit();
    bool ValueDependent = Init->isValueDependent(); --> 'Init' is dereferenced by being passed as argument 0 to function "isValueDependent
    bool isConstantInit =
       Init && !ValueDependent && Init->isConstantInitializer(Context, false);  --> 'Init' is checked for NULL here

This patch adds NULL value checking for 'Init' expression.

Signed-off-by: Soumi Manna <soumi.manna@intel.com>
@bader bader merged commit 8c5b701 into intel:sycl Dec 21, 2021
alexbatashev added a commit to alexbatashev/llvm that referenced this pull request Dec 23, 2021
* upstream/sycl: (1382 commits)
  [SYCL][XPTI] Report memory allocation info from SYCL runtime (intel#5172)
  [CI] Switch labels for OCL x64 job (intel#5185)
  [SYCL] Add basic support for the generic_space address space (intel#5148)
  [CI] Update CODEOWNERS for SYCL printf support passes (intel#5199)
  [SYCL][Matrix] Enable wi_slice for joint_matrix (intel#4979)
  [SYCL][Group algorithms] Move group sort extension to experimental (intel#5169)
  [SYCL] Fix kernel bundles don't really carry kernel IDs (intel#5121)
  [SYCL] Initial printf support for non-constant AS format strings (intel#5069)
  [SYCL][NFC] Fix static code analysis concerns (intel#5189)
  [SYCL][Doc] Fix typos to fix doc build (intel#5190)
  [Driver][SYCL] Turn on -fsycl-dead-args-optimization by default (intel#3004)
  [SYCL][L0][Plugin] Add support for batching copy commands (intel#5155)
  [CI] Add cache checkout script to docker containers (intel#5184)
  [SYCL][Doc] Add HIP backend to the filter selector (intel#5176)
  [Doc] Add documentation for Docker images (intel#4778)
  [LIBCLC] Add functionality for in-kernel asserts for CUDA backend (intel#5174)
  Force opt to use new pass manager in exponential-deferred-inlining test after a8c2ba1
  [SYCL] Add vec and marray support to known_identity type trait (intel#5163)
  Correctly resolve merge conflicts
  Update SPV_INTEL_hw_thread_queries to rev 2
  ...
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.

4 participants