Skip to content

Fix SAI_STATUS_IS_* attribute-range helpers for negative status codes#2308

Open
MoriLevinzon wants to merge 1 commit into
opencomputeproject:masterfrom
MoriLevinzon:fix/attr-status-range-helpers
Open

Fix SAI_STATUS_IS_* attribute-range helpers for negative status codes#2308
MoriLevinzon wants to merge 1 commit into
opencomputeproject:masterfrom
MoriLevinzon:fix/attr-status-range-helpers

Conversation

@MoriLevinzon

Copy link
Copy Markdown

Fixes #2307

Two fixes in the SAI_STATUS_IS_* helpers in inc/saistatus.h:

  • Compare on the magnitude (SAI_STATUS_CODE(x)) before masking, so the range
    check is correct for negative status codes on Linux. Previously a non-zero
    attribute index borrowed across the 16-bit boundary and matched the wrong
    range (e.g. INVALID_ATTR_VALUE index 3 classified as ATTR_NOT_IMPLEMENTED).
    No-op on Windows, where SAI_STATUS_CODE is identity.
  • Fix SAI_STATUS_IS_UNKNOWN_ATTRIBUTE, which compared against
    SAI_STATUS_INVALID_ATTRIBUTE_0 instead of SAI_STATUS_UNKNOWN_ATTRIBUTE_0
    (wrong on all platforms).

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.

SAI_STATUS_IS_* attribute range helpers: wrong for negative status codes on Linux, and IS_UNKNOWN_ATTRIBUTE checks the wrong base (all platforms)

1 participant