-
Notifications
You must be signed in to change notification settings - Fork 321
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
ipc-helper.c: reject invalid SOF_MEM_CAPS_* bits #8850
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
12aff94
to
9cd5f71
Compare
Unrelated "signal overflow!" failure in https://sof-ci.01.org/sofpr/PR8850/build2957/devicetest/index.html?model=MTLP_RVP_NOCODEC&testcase=check-alsabat-headset-playback-997 on 1 unrelated suspend/resume failure in https://sof-ci.01.org/sofpr/PR8850/build2958/devicetest/index.html, everything else green. 1 unrelated failure in https://sof-ci.01.org/sof-pr-viewer/#/build/PR8850/build13640869, every other test is green.
|
src/include/ipc/topology.h
Outdated
@@ -87,6 +87,8 @@ struct sof_ipc_comp { | |||
#define SOF_MEM_CAPS_EXEC BIT(7) /**< executable */ | |||
#define SOF_MEM_CAPS_L3 BIT(8) /**< L3 memory */ | |||
|
|||
#define SOF_MEM_CAPS_MAX_BIT BIT(8) /**< Used for input validation */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is ABI, its better we make it obvious via an inline comment that MAX_BIT needs to be updated for any new MEM_CAPS addition. I would also define MAX_BIT as CAPS_L3 rather than BIT(8) as this makes it even clearer to anyone reading the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we make it obvious via an inline comment that MAX_BIT needs to be updated for any new MEM_CAPS addition.
Comment added.
I would also define MAX_BIT as CAPS_L3 rather than BIT(8) as this makes it even clearer to anyone reading the code.
I can't do that because I realized v2 12aff94 was buggy, apologies. In v2 I made _MAX equal to the last last valid bit but that is wrong, it would incorrectly reject _MAX + some other BIT. The tests passed anyway because we don't seem to test L3_HEAP.
The comparison must be with the first invalid bit. I confused myself with the name "_MAX", it is a bad name. I just replaced it with _LOWEST_INVALID = max << 1
Fixes lack of SOF_MEM_CAPS_* input validation found in thesofproject#8832 Signed-off-by: Marc Herbert <[email protected]>
9cd5f71
to
10cba1f
Compare
Only suspend/resume failures in CAVS https://sof-ci.01.org/sofpr/PR8850/build2989/devicetest/index.html ACE https://sof-ci.01.org/sofpr/PR8850/build2988/devicetest/index.html is all green. |
Fixes lack of SOF_MEM_CAPS_* input validation found in #8832