public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: intel_soc_pmic: Add missing error check for devm_kzalloc
@ 2015-02-11 10:10 Kiran Padwal
  2015-02-16 12:51 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Kiran Padwal @ 2015-02-11 10:10 UTC (permalink / raw)
  To: Lee Jones; +Cc: Samuel Ortiz, linux-kernel, Kiran Padwal, Kiran Padwal

This patch add a missing check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
---
 drivers/mfd/intel_soc_pmic_core.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index df7b064..80cef04 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -64,6 +64,9 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
 	config = (struct intel_soc_pmic_config *)id->driver_data;
 
 	pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
+	if (!pmic)
+		return -ENOMEM;
+
 	dev_set_drvdata(dev, pmic);
 
 	pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-16 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 10:10 [PATCH] mfd: intel_soc_pmic: Add missing error check for devm_kzalloc Kiran Padwal
2015-02-16 12:51 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox