Attention is currently required from: Krystian Hebel. Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/55038 )
Change subject: src/lib/fmap.c: use le*toh() functions where needed ......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1: To catch all the places where wrapping is needed, you could try coccinelle (https://coccinelle.gitlabpages.inria.fr/website/) with the following semantic patch. It has some weaknesses because it would wrap things multiple times on re-invocation, but it at least should point out the right places to look into and patch in something vaguely reasonable.
@ lhs_nareas @ struct fmap f; expression E; @@ f.nareas = + htole16( E + ) ; @ lhs_flags @ struct fmap f; expression E; @@ f.flags = + htole16( E + ) ; @ lhs_size @ struct fmap f; expression E; @@ f.size = + htole32( E + ) ; @ lhs_offset @ struct fmap f; expression E; @@ f.offset = + htole32( E + ) ; @ lhs_base @ struct fmap f; expression E; @@ f.base = + htole64( E + ) ; @ depends on !lhs_nareas @ struct fmap f; @@ + le16toh( f.nareas +) @ depends on !lhs_flags @ struct fmap f; @@ + le16toh( f.flags +) @ depends on !lhs_size @ struct fmap f; @@ + le32toh( f.size +) @ depends on !lhs_offset @ struct fmap f; @@ + le32toh( f.offset +) @ depends on !lhs_base @ struct fmap f; @@ + le64toh( f.base +)