Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@singalsu Can you check this?
The idea was really to have common handling for process types and not need to enumerate process types in so many places. OTOH, this was more of a concern to Linux kernel side (needed to change the Linux kernel for every new SOF module type would not scale). We certainly know the superset of modules that can be used, but this leaves the operational risk that a new component type needs to be added here as well.
If malicious host uses an invalid type, it can just as well use one of the valid component types, and use invalid fields for rest of values, right?
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.
The problem here was that components that were not expected to be in the module adapter (DAI) were being cast to process IPCs and resulting in out of bounds accesses. My opinion we have 2 problems here.
Uh oh!
There was an error while loading. Please reload this page.
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.
how about adding an enumeration value after all the valid DSP-bound (not testing ones) components and using
?
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.
Doesn't work as *HOST and *DAI also caught in that range and that is intentionally not being caught here.
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.
For reference, this is a copy from here
Which raises the question, are the missing COMPs also supposed to be here? If yes this further backs my suggestions in my previous comment to dissolve these hard coded types in the component layer.
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.
@cujomalainey ah, so they would go to
default? But they aren't really "unsupported," they're just invalid for this operation? But ok, maybe would be good then to explicitly add them to thedefaultcaseas
or at least mention that in a comment, but that's cosmetics, not really important.
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.
I would recommend not adding the above to the default case. As much as it makes it exhaustive (which in something like rust would actually be important as it affects compilation) here it is cosmetic as you said so I would like the intention of added cases to be only for types that can be instantiated and not mix intents of support. Personal preference though.