The macro violates the strict aliasing rules. By using the newly introduced
may_alias attribute we can prevent miscompilations because of that.
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GiHub-Closes: #1076
* versa. They are at the end for backwards compatibility.
*/
#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
-#define vring_avail_event(vr) (*(__virtio_le16 *)&(vr)->used->ring[(vr)->num])
+typedef __virtio_le16 __may_alias __virtio_le16_ma;
+#define vring_avail_event(vr) \
+ (*(__virtio_le16_ma *)&(vr)->used->ring[(vr)->num])
static inline void vring_init(struct vring *vr, unsigned int num, uint8_t *p,
unsigned long align)