Workaround clang alignment warnings (Wcast-align) when working with byt arrays.

This should silence similar warnings like
  warning: cast from 'char *' to 'struct xyz *' increases required alignment from 1 to X
when we try to calclulate byte pointer offsets in a buffer.
This commit is contained in:
Milan Broz
2022-01-20 12:09:44 +01:00
parent c11a83bf0f
commit 0b2c4187b0
6 changed files with 27 additions and 15 deletions

View File

@@ -264,8 +264,8 @@ static int TCRYPT_hdr_from_disk(struct crypt_device *cd,
*/
static void TCRYPT_swab_le(char *buf)
{
uint32_t *l = (uint32_t*)&buf[0];
uint32_t *r = (uint32_t*)&buf[4];
uint32_t *l = VOIDP_CAST(uint32_t*)&buf[0];
uint32_t *r = VOIDP_CAST(uint32_t*)&buf[4];
*l = swab32(*l);
*r = swab32(*r);
}