]> git.ipfire.org Git - thirdparty/systemd.git/commit
efivars: remove direct access to unaligned structure members
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Feb 2019 16:35:39 +0000 (17:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Feb 2019 17:15:00 +0000 (18:15 +0100)
commit3c7dddaccf2dba72b7718eaab4247cac542b4417
tree5885fada4a201cd65c4db666b9f0c31204b2d9de
parentf7cb1c7900951c1c01b2cddb4462c35af2933114
efivars: remove direct access to unaligned structure members

Most of the accesses *were* aligned. The only one that definetely wasn't was to
drive_path->part_start and drive_path->part_size, because those both expect
8 byte alignment, and are at offsets 4 and 12 in the packed structure.

Because of the way that device_path structure is defined and used, we expect
that device_path.length is always two-byte aligned.

This adds asserts in various places to ensure the proper alignment, and uses
memcpy in other places where the alignment might be off.
src/shared/efivars.c