lcp / mokutil

The utility to manipulate machine owner keys
GNU General Public License v3.0
70 stars 38 forks source link

Fix -Wcast-align warnings #31

Closed tstellar closed 4 years ago

tstellar commented 4 years ago

This fixes a few -Wcast-algin warnings emitted by clang. e.g

mokutil.c:1866:26: error: cast from 'uint8_t ' (aka 'unsigned char ') to 'uint32_t ' (aka 'unsigned int ') increases required alignment from 1 to 4 [-Werror,-Wcast-align] secureboot = (int32_t)(uint32_t )data; ^~~~ Casting from uint8_t to uint32_t is undefined behavior and can also lead to bugs on platforms that require pointers to be aligned to the load size.

I think I was able to duplicate the existing logic, but I was unsure how to test this.