Skip to contentSkip to conversation

ASoC: mop500_ab8500: Add a NULL pointer check in mop500_ab8500_machine_init()

PATCH Applied Rajan Vaja 2 participants 2 messages May 20, 2015 – May 21, 2015

Subsystems (2)
lore
Share & tools
lore

Rajan Vaja

author
#0 lore raw

PATCH 1/1 ASoC: mop500_ab8500: Add a NULL pointer check in mop500_ab8500_machine_init()

Avoid possible crash (NULL pointer dereference) by making sure that dem_kzalloc() is successful.

---
 sound/soc/ux500/mop500_ab8500.c |    4 ++++
 1 file changed, 4 insertions(+)
sound/soc/ux500/mop500_ab8500.c +4 -0
index b81a7a4c..85d810d 100644
@@ -372,6 +372,10 @@ int mop500_ab8500_machine_init(struct snd_soc_pcm_runtime *rtd)
 	/* Create driver private-data struct */
 	drvdata = devm_kzalloc(dev, sizeof(struct mop500_ab8500_drvdata),
 			GFP_KERNEL);
+
+	if (!drvdata)
+		return -ENOMEM;
+
 	snd_soc_card_set_drvdata(rtd->card, drvdata);
 
 	/* Setup clocks */
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw
Quoted 2 lines · Rajan Vaja

Avoid possible crash (NULL pointer dereference) by making sure that dem_kzalloc() is successful.

Applied, thanks.