Patch "drm/msm/dpu: Fix bit-shifting UB in DPU_HW_VER() macro" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/msm/dpu: Fix bit-shifting UB in DPU_HW_VER() macro

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-msm-dpu-fix-bit-shifting-ub-in-dpu_hw_ver-macro.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7a8a0a37c7fa2c6e1f0363a64bc5270946e06d2e
Author: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Date:   Mon Mar 6 10:06:33 2023 +0100

    drm/msm/dpu: Fix bit-shifting UB in DPU_HW_VER() macro
    
    [ Upstream commit 4760be481dc075cd13f95f4650f5d5b53b4b336d ]
    
    With gcc-5 and CONFIG_UBSAN_SHIFT=y:
    
        drivers/gpu/drm/msm/msm_mdss.c: In function 'msm_mdss_enable':
        drivers/gpu/drm/msm/msm_mdss.c:296:2: error: case label does not reduce to an integer constant
          case DPU_HW_VER_800:
          ^
        drivers/gpu/drm/msm/msm_mdss.c:299:2: error: case label does not reduce to an integer constant
          case DPU_HW_VER_810:
          ^
        drivers/gpu/drm/msm/msm_mdss.c:300:2: error: case label does not reduce to an integer constant
          case DPU_HW_VER_900:
          ^
    
    This happens because for major revisions 8 or greather, the non-sign bit
    of the major revision number is shifted into bit 31 of a signed integer,
    which is undefined behavior.
    
    Fix this by casting the major revision number to unsigned int.
    
    Fixes: efcd0107727c4f04 ("drm/msm/dpu: add support for SM8550")
    Fixes: 4a352c2fc15aec1e ("drm/msm/dpu: Introduce SC8280XP")
    Fixes: 100d7ef6995d1f86 ("drm/msm/dpu: add support for SM8450")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Reviewed-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
    Reviewed-by: Rob Clark <robdclark@xxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/525152/
    Link: https://lore.kernel.org/r/20230306090633.65918-1-geert+renesas@xxxxxxxxx
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
index e6590302b3bfc..2c5bafacd609c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -19,8 +19,9 @@
  */
 #define MAX_BLOCKS    12
 
-#define DPU_HW_VER(MAJOR, MINOR, STEP) (((MAJOR & 0xF) << 28)    |\
-		((MINOR & 0xFFF) << 16)  |\
+#define DPU_HW_VER(MAJOR, MINOR, STEP)			\
+		((((unsigned int)MAJOR & 0xF) << 28) |	\
+		((MINOR & 0xFFF) << 16) |		\
 		(STEP & 0xFFFF))
 
 #define DPU_HW_MAJOR(rev)		((rev) >> 28)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux