summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Opaniuk <igor.opaniuk@toradex.com>2020-06-17 01:00:45 +0300
committerIgor Opaniuk <igor.opaniuk@toradex.com>2020-06-17 01:00:45 +0300
commit8a9a70a8db1f6864787db8b53364a130acdfc3f8 (patch)
treee97519ead603de5203d1bc03b8a73270d765303e
parent98fb85957e377b637e555ad369179c22fff24582 (diff)
tdx-cfg-block: fix serial number creation
Add proper calculation of offset for data structures, which size is not multiple of 4 bytes. Testing: Verdin iMX8MM # cfgblock create 0038100206603368 A valid Toradex config block is present, still recreate? [y/N] y Toradex config block successfully written Verdin iMX8MM # reset resetting ... U-Boot 2018.03-00013-g98fb859-dirty (Jun 17 2020 - 00:58:58 +0300) ... Model: ..., Serial#06603368 Relates-to: ELB-2772 Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
-rw-r--r--board/toradex/common/tdx-cfg-block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 9d202e39c8..9e5fe95982 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -610,7 +610,7 @@ static int write_tag(u8 *config_block, int *offset, int tag_id,
tag->id = tag_id;
tag->flags = TAG_FLAG_VALID;
/* len is provided as number of 32bit values after the tag */
- tag->len = tag_data_size / sizeof(u32);
+ tag->len = (tag_data_size + sizeof(u32) - 1) / sizeof(u32);
*offset += sizeof(struct toradex_tag);
if (tag_data && tag_data_size) {
memcpy(config_block + *offset, tag_data,