Module: Mesa
Branch: main
Commit: 145cb3e349d080dce3d6e8f41722dffe33ab7b9f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=145cb3e349d080dce3d6e8f41722dffe33ab7b9f

Author: Simon Ser <[email protected]>
Date:   Tue Nov  8 15:26:03 2022 +0100

vulkan/wsi/wayland: fix unaligned load of dev_t

Fixes the following UBSan error:

    ../src/vulkan/wsi/wsi_common_wayland.c:654:27: runtime error: load of 
misaligned address 0x6110000666b4 for type 'dev_t' (aka 'unsigned long'), which 
requires 8 byte alignment

Signed-off-by: Simon Ser <[email protected]>
Reviewed-by: Leandro Ribeiro <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19595>

---

 src/vulkan/wsi/wsi_common_wayland.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 405d917441d..e4de881bf40 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -647,8 +647,7 @@ default_dmabuf_feedback_main_device(void *data,
    struct wsi_wl_display *display = data;
 
    assert(device->size == sizeof(dev_t));
-   dev_t *dev = device->data;
-   display->main_device = *dev;
+   memcpy(&display->main_device, device->data, device->size);
 }
 
 static void

Reply via email to