[PATCH] drm/gud: Fix descriptor magic check

Noralf Trønnes noralf at tronnes.org
Wed Nov 24 20:14:38 UTC 2021


le32_to_cpu() was put around the wrong operand in the descriptor magic
value check. Fix this and put it around the descriptor value which is the
one that is in little endian format.

Fixes: 40e1a70 ("drm: Add GUD USB Display driver")
Reported-by: kernel test robot <lkp at intel.com>
Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
---
 drivers/gpu/drm/gud/gud_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c
index 3f9d4b9a1e3d..e6db478f1e49 100644
--- a/drivers/gpu/drm/gud/gud_drv.c
+++ b/drivers/gpu/drm/gud/gud_drv.c
@@ -92,7 +92,7 @@ static int gud_get_display_descriptor(struct usb_interface *intf,
 	if (ret != sizeof(*desc))
 		return -EIO;
 
-	if (desc->magic != le32_to_cpu(GUD_DISPLAY_MAGIC))
+	if (le32_to_cpu(desc->magic) != GUD_DISPLAY_MAGIC)
 		return -ENODATA;
 
 	DRM_DEV_DEBUG_DRIVER(&intf->dev,
-- 
2.33.0



More information about the dri-devel mailing list