Skip to content
Permalink
Browse files Browse the repository at this point in the history
secvar: fix endian conversion
unpack_timestamp() calls le32_to_cpu() for endian conversion of
uint16_t "year" value. This patch fixes the code to use le16_to_cpu().

Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
  • Loading branch information
naynajain authored and Vasant Hegde committed Jun 24, 2021
1 parent 1cdde94 commit 5be38b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libstb/secvar/backend/edk2-compat-process.c
Expand Up @@ -370,7 +370,7 @@ int update_timestamp(const char *key, const struct efi_time *timestamp, char *la
static uint64_t unpack_timestamp(const struct efi_time *timestamp)
{
uint64_t val = 0;
uint16_t year = le32_to_cpu(timestamp->year);
uint16_t year = le16_to_cpu(timestamp->year);

/* pad1, nanosecond, timezone, daylight and pad2 are meant to be zero */
val |= ((uint64_t) timestamp->pad1 & 0xFF) << 0;
Expand Down

0 comments on commit 5be38b6

Please sign in to comment.