On Saturday, 18 December 2021 09:37:02 CET Sven Eckelmann wrote: > Why are you defining it as `u8 replay_counter[GTK_REPLAY_COUNTER_BYTES];` in > the struct instead of using `__le64 replay_counter;`? > > What ensures that this is value is 64 bit aligned in memory? Wouldn't it be > more correct to (see above) use > > replay_ctr = cpu_to_be64(get_unaligned_le64(ev->replay_counter)); > Sorry for the noise, but the part of not knowing in which endianness the firmware return multi-byte values is freaking me out. The above statements assume that it is returning everything as little endian. If it is actually returns in host byte order (no idea how the firmware determines this) then of course, the questions should be: * Why are you defining it as `u8 replay_counter[GTK_REPLAY_COUNTER_BYTES];` in the struct instead of using `u64 replay_counter;`? * What ensures that this is value is 64 bit aligned in memory? Wouldn't it be more correct (assuming it is a u64) to use replay_ctr = cpu_to_be64(get_unaligned64(ev->replay_counter)); Kind regards, Sven
Attachment:
signature.asc
Description: This is a digitally signed message part.