-
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
rimage: stop ignoring errors in parse_uuid() #8366
Conversation
assert() that sscanf returns the expected value. Signed-off-by: Marc Herbert <[email protected]>
Fixes compilation failure with clang 15: rimage/src/toml_utils.c:297:67: error: taking address of packed member 'd0' of class or structure 'uuid_t' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] sscanf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", &id.d0, ^~~~ This also aligns indexes. Signed-off-by: Marc Herbert <[email protected]>
Add missing `const` and warn that the endianness can't be relied on. Signed-off-by: Marc Herbert <[email protected]>
https://github.com/thesofproject/sof/actions/runs/6591943429/job/17911586211?pr=8366 has only DOS line endings warnings. Only one suspend/resume failure in ACE https://sof-ci.01.org/sofpr/PR8366/build13987/devicetest/index.html CAVS is all green https://sof-ci.01.org/sofpr/PR8366/build13988/devicetest/index.html |
* Parse UUID hex string into a byte array. The endianness of the output | ||
* is architecture-dependent: do not use in any portable code. | ||
*/ | ||
void parse_uuid(const char *buf, uint8_t *uuid); |
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 Rimage is part of sof repository can we add ifdef condition for Intel adsp?
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.
Feel free to submit a follow-up PR after this one. This is one is just a minor clean-up.
tools/rimage/src/toml_utils.c
Outdated
@@ -294,8 +295,12 @@ void parse_uuid(char *buf, uint8_t *uuid) | |||
struct uuid_t id; | |||
uint32_t d[10]; | |||
|
|||
const int parsed_uuid_fields = | |||
sscanf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", &id.d0, &d[0], | |||
&d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7], &d[8], &d[9]); |
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.
would be good to indent this, e.g. as
const int parsed_uuid_fields = sscanf(buf,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
...
3 commits.
Also fix compilation with clang 15
I checked that the MTL checksums are identical before/after these code changes.