Skip to contentSkip to conversation

edac_mc: check for allocation failure in edac_mc_alloc()

PATCH New Dan Carpenter 1 participant 1 message May 18, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 edac_mc: check for allocation failure in edac_mc_alloc()

Add a check here for if kzalloc() failed.

drivers/edac/edac_mc.c +2 -0
index f9c75f9..138c545 100644
@@ -352,6 +352,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
 		}
 
 		dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL);
+		if (!dimm)
+			goto error;
 		mci->dimms[off] = dimm;
 		dimm->mci = mci;