diff options
author | Daniel Axtens <dja@axtens.net> | 2021-06-23 19:41:54 +1000 |
---|---|---|
committer | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2021-07-20 10:47:16 +0530 |
commit | d722dc185bcf86a28ad8710ccc0b5a02b4ea0fc2 (patch) | |
tree | 9bb65220ed21b18f5f3ea830c4dff9abebc482f2 /libstb/secvar/test/secvar-test-edk2-compat.c | |
parent | 7c4862ebd8de5d13243c6a3dc2bfb9ef7b3ab174 (diff) | |
download | skiboot-d722dc185bcf86a28ad8710ccc0b5a02b4ea0fc2.zip skiboot-d722dc185bcf86a28ad8710ccc0b5a02b4ea0fc2.tar.gz skiboot-d722dc185bcf86a28ad8710ccc0b5a02b4ea0fc2.tar.bz2 |
secvar/backend: use endian-aware types in edk2.h
Recently we had an issue where we did the following:
uint16_t year = le32_to_cpu(timestamp->year);
This is wrong and will break on BE. However, we didn't catch this
with sparse because there was a whole slew of warnings.
The reason for the slew of warnings is that we didn't annotate the
types that store little-endian specific data in edk2.h.
Provide the appropriate annotations.
We now get a single sparse warning for the file, which correctly
identifies the issue:
edk2-compat-process.c:374:46: warning: incorrect type in argument 1 (different base types)
edk2-compat-process.c:374:46: expected restricted leint32_t [usertype] le_val
edk2-compat-process.c:374:46: got restricted leint16_t const [usertype] year
We do lose the signedness of efi_time->timezone, but that's probably OK:
we never use the timezone anyway and the comment above the data structure
makes the signedness pretty clear.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'libstb/secvar/test/secvar-test-edk2-compat.c')
0 files changed, 0 insertions, 0 deletions