[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 10 Oct 2010 21:39:46 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Vasiliy Kulikov <segooon@...il.com>
Cc: kernel-janitors@...r.kernel.org,
Samuel Ortiz <sameo@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] mfd/mc13xxx: don't open code kasprintf
This fixes an off by one error noticed by Vasiliy Kulikov en passant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
drivers/mfd/mc13xxx-core.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 93258ad..b763b8c 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -687,7 +687,6 @@ EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion);
static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
const char *format, void *pdata, size_t pdata_size)
{
- char buf[30];
const char *name = mc13xxx_get_chipname(mc13xxx);
struct mfd_cell cell = {
@@ -695,11 +694,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
.data_size = pdata_size,
};
- /* there is no asnprintf in the kernel :-( */
- if (snprintf(buf, sizeof(buf), format, name) > sizeof(buf))
- return -E2BIG;
-
- cell.name = kmemdup(buf, strlen(buf) + 1, GFP_KERNEL);
+ cell.name = kasprintf(GFP_KERNEL, format, name);
if (!cell.name)
return -ENOMEM;
--
1.7.2.3
--
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