Skip to content

{bp-19438} arch/common: fix host_flags_to_mode() O_RDONLY sentinel collision - #19620

Merged
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19438
Aug 3, 2026
Merged

{bp-19438} arch/common: fix host_flags_to_mode() O_RDONLY sentinel collision#19620
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19438

Conversation

@jerpelea

@jerpelea jerpelea commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

host_flags_to_mode() used a trailing 0 entry in modeflags[] as the loop-termination sentinel. O_RDONLY is defined as 0 and is exactly modeflags[1], so the loop's termination check fired before ever comparing that entry, and a bare O_RDONLY open always fell through to -EINVAL.

Bound the loop by array size (nitems()) instead of a value sentinel.

Impact

RELEASE

Testing

CI

host_flags_to_mode() used a trailing 0 entry in modeflags[] as the
loop-termination sentinel. O_RDONLY is defined as 0 and is exactly
modeflags[1], so the loop's termination check fired before ever
comparing that entry, and a bare O_RDONLY open always fell through
to -EINVAL.

Bound the loop by array size (nitems()) instead of a value sentinel.

Signed-off-by: liang.huang <liang.huang@houmo.ai>
@jerpelea
jerpelea requested a review from masayuki2009 as a code owner August 3, 2026 08:19
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: S The size of the change in this PR is small labels Aug 3, 2026
@xiaoxiang781216
xiaoxiang781216 merged commit 335aacb into apache:releases/13.0 Aug 3, 2026
16 of 41 checks passed
@jerpelea
jerpelea deleted the bp-19438 branch August 3, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants