[PATCH 1/9] EDAC/versalnet: Add NULL check for mci in handle_error()

From: Shubhrajyoti Datta

Date: Fri Jul 24 2026 - 13:24:32 EST


Add a NULL pointer check for mci before use in handle_error() to
prevent a potential NULL dereference when the memory controller
instance is not initialized for a given controller number.

This is added as a defensive check. In our current firmware
the event will not be generated.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxx>
---

drivers/edac/versalnet_edac.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/edac/versalnet_edac.c b/drivers/edac/versalnet_edac.c
index d1af5e175f7e..316f8f79c4d8 100644
--- a/drivers/edac/versalnet_edac.c
+++ b/drivers/edac/versalnet_edac.c
@@ -439,6 +439,8 @@ static void handle_error(struct mc_priv *priv, struct ecc_status *stat,
return;

mci = priv->mci[ctl_num];
+ if (!mci)
+ return;

if (stat->error_type == MC5_ERR_TYPE_CE) {
pinf = stat->ceinfo[stat->channel];
--
2.34.1