Skip to content
Snippets Groups Projects
Commit 9ec22ac4 authored by Priyanka Singh's avatar Priyanka Singh Committed by Borislav Petkov (AMD)
Browse files

EDAC/fsl_ddr: Fix bad bit shift operations


Fix undefined behavior caused by left-shifting a negative value in the
expression:

    cap_high ^ (1 << (bad_data_bit - 32))

The variable bad_data_bit ranges from 0 to 63. When it is less than 32,
bad_data_bit - 32 becomes negative, and left-shifting by a negative
value in C is undefined behavior.

Fix this by combining cap_high and cap_low into a 64-bit variable.

  [ bp: Massage commit message, simplify error bits handling. ]

Fixes: ea2eb9a8 ("EDAC, fsl-ddr: Separate FSL DDR driver from MPC85xx")
Signed-off-by: default avatarPriyanka Singh <priyanka.singh@nxp.com>
Signed-off-by: default avatarLi Yang <leoyang.li@nxp.com>
Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20241016-imx95_edac-v3-3-86ae6fc2756a@nxp.com
parent 5d9aeaa6
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment