[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1290791209-21493-1-git-send-email-segoon@openwall.com>
Date: Fri, 26 Nov 2010 20:06:47 +0300
From: Vasiliy Kulikov <segoon@...nwall.com>
To: kernel-janitors@...r.kernel.org
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Anton Vorontsov <cbouatmailru@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] power: gpio-charger: fix potential NULL dereference
kzalloc() may fail, if so return with -ENOMEM.
Signed-off-by: Vasiliy Kulikov <segoon@...nwall.com>
---
Compile tested only.
drivers/power/gpio-charger.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
index fccbe99..41e4687 100644
--- a/drivers/power/gpio-charger.c
+++ b/drivers/power/gpio-charger.c
@@ -87,6 +87,8 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev)
}
gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
+ if (gpio_charger == NULL)
+ return -ENOMEM;
charger = &gpio_charger->charger;
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists