On Thu, 2025-07-24 at 00:37 +0900, Masami Hiramatsu wrote: > On Wed, 23 Jul 2025 12:49:25 +0200 > Ben Hutchings <[email protected]> wrote: [...] > > static int apply_xbc(const char *path, const char *xbc_path) > > { > > - char *buf, *data, *p; > > + struct { > > + uint32_t size; > > + uint32_t csum; > > + char magic[BOOTCONFIG_MAGIC_LEN]; > > + } footer; > > Don't we need __attribute__((__packed__)) for the footer?
I don't see any reason for there to be padding in this structure, since it has an alignment of 4 and the size of each member is a multiple of 4. I included an assertion that there is no padding: [...] > > + memcpy(footer.magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN); > > + static_assert(sizeof(footer) == BOOTCONFIG_FOOTER_SIZE); > > + memcpy(data + size, &footer, BOOTCONFIG_FOOTER_SIZE); [...] Ben. -- Ben Hutchings - Debian developer, member of kernel, installer and LTS teams
signature.asc
Description: This is a digitally signed message part
