Skip to content

Make CodeQL happy for underflow issue - #477

Merged
crtrott merged 1 commit into
kokkos:stablefrom
crtrott:codeql-fix
Sep 30, 2026
Merged

crtrott merged 1 commit into
kokkos:stablefrom
crtrott:codeql-fix

Conversation

@crtrott

@crtrott crtrott commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

This is a false positive due to the way the fold expression, is actually empty when rank==0 but just modifying the condition is an easy way to make it happy.

Was reported as security vulnerability on Kokkos Core.

This is a false positive due to the way the fold expression,
is actually empty when rank==0 but just modifying the
condition is an easy way to make it happy.

Signed-off-by: Christian Trott <crtrott@sandia.gov>

@mhoemmen mhoemmen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Christian! : - )

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The revised condition can still overflow unsigned arithmetic and produce an incorrect mapping.

Review effort: Lite
Findings: None

What changed in this PR

This pull request updates the right-padded submdspan static-stride condition to avoid CodeQL’s unsigned-underflow warning.

Changes:

  • Replaces subtraction-based bounds checks with addition-based checks.
  • Documents the condition change.
File Description
include/​experimental/​__p2630_bits/​submdspan_mapping.hpp Adjusts right-layout static stride computation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@crtrott
crtrott merged commit 3876362 into kokkos:stable Sep 30, 2026
15 checks passed
dalg24 pushed a commit to kokkos/kokkos that referenced this pull request Oct 15, 2026
mdspan PRs included:
- fixup project name [#474](kokkos/mdspan#474)
- run pre-commit [#475](kokkos/mdspan#475)
- strided_slice [#476](kokkos/mdspan#476)
- codeql underflow issue [#477](kokkos/mdspan#477)
- license fixup [#478](kokkos/mdspan#478)
- range-slice [#479](kokkos/mdspan#479)

Signed-off-by: Christian Trott <crtrott@sandia.gov>
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.

3 participants