wayland: Fix an ubsan warning

dev_t requires 8-byte alignment, so we need to use memcpy.
This commit is contained in:
Matthias Clasen 2024-04-21 21:32:41 -04:00
parent f896dddadc
commit 815df9a76a

View File

@ -313,7 +313,9 @@ linux_dmabuf_main_device (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
struct wl_array *device)
{
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
dev_t dev G_GNUC_UNUSED;
memcpy (&dev, device->data, sizeof (dev_t));
GDK_DEBUG (MISC, "got dmabuf main device: %u %u", major (dev), minor (dev));
}
@ -330,7 +332,9 @@ linux_dmabuf_tranche_target_device (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
struct wl_array *device)
{
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
dev_t dev G_GNUC_UNUSED;
memcpy (&dev, device->data, sizeof (dev_t));
GDK_DEBUG (MISC, "got dmabuf tranche target device: %u %u", major (dev), minor (dev));
}