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.
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
ASoC: SOF: Fix skipping empty trace filters #2516
ASoC: SOF: Fix skipping empty trace filters #2516
Changes from all commits
c0bfcbb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@ktrzcinx Hmm, the sscanf just to read whitespace seems a bit odd. How about if we consume the linefeed in the existing sscanf calll on L51. Would this work?
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.
rather to check if input string consist only from whitespaces or is empty one, so its eg one of
"\0"
,"\n\0"
," \0"
," \n\0"
.I think it shortest and reliable solution as long as reader are familiar with
scanf()
format string. I didn't use any hack here, it's just standard function usage.There already is linefeed consumer in the existing sscanf calll on L51 and it doesn't work in all situations 😄. The case here is parsing last entry of
strsep("0 0 0 0;\n", ";")
, it will be "\n", so scanning 4 numbers fails for it. Without this fix it works forstrsep("0 0 0 0;", ";")
, because then last entry is"\0"
iirc.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.
@ktrzcinx Thanks. I agree this is probably the cleanest, but I'm still not entirely convinced having this sort of relaxed parsing in kernel space is the right place. I mean "0 0 0 0;\n" is an invalid input in the end. Why have extra code in kernel for something user-space can easily just get 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.
Without this change we have some inconsistence -
"0 0 0 0;\n"
returns parsing error but"0 0 0 0\n"
passes, after change it will be consistent.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 get the point @ktrzcinx about detecting a line with whitespaces only, but I don't get how this change helps you detect
"0 0 0 0;\n" from "0 0 0 0\n"
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.
@plbossart
"0 0 0 0;\n"
will be split to"0 0 0 0\0"
(parsed with success) and"\n"
(rising parse error without this patch). Such and situation doesn't happen for"0 0 0 0\n"
, because there's no spiting char, and this text will be consumed at once.