In emif_get_id(), of_get_address() may return NULL which is later dereferenced. Fix this bug by adding NULL check. Cc: stable@xxxxxxxxxxxxxxx Fixes: 6f15b178cd63 ("EDAC/versal: Add a Xilinx Versal memory controller driver") Signed-off-by: Ma Ke <make24@xxxxxxxxxxx> --- Changes in v3: - added Cc stable line. Changes in v2: - fixed the typo according to suggestions. --- drivers/edac/versal_edac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/edac/versal_edac.c b/drivers/edac/versal_edac.c index a556d23e8261..7aa9468acd53 100644 --- a/drivers/edac/versal_edac.c +++ b/drivers/edac/versal_edac.c @@ -1053,6 +1053,9 @@ static u32 emif_get_id(struct device_node *node) const __be32 *addrp; addrp = of_get_address(node, 0, NULL, NULL); + if (!addrp) + return -EINVAL; + my_addr = (u32)of_translate_address(node, addrp); for_each_matching_node(np, xlnx_edac_match) { -- 2.25.1