[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 10 Oct 2010 21:28:31 +0400
From: Vasiliy Kulikov <segooon@...il.com>
To: kernel-janitors@...r.kernel.org
Cc: Samuel Ortiz <sameo@...ux.intel.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>, linux-kernel@...r.kernel.org
Subject: [PATCH] drivers: mfd: fix off by one error
snprintf() is overflowed iff result is greater or equal than
argument "size".
Signed-off-by: Vasiliy Kulikov <segooon@...il.com>
---
Compile tested.
drivers/mfd/mc13xxx-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 93258ad..cd4d670 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -696,7 +696,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
};
/* there is no asnprintf in the kernel :-( */
- if (snprintf(buf, sizeof(buf), format, name) > sizeof(buf))
+ if (snprintf(buf, sizeof(buf), format, name) >= sizeof(buf))
return -E2BIG;
cell.name = kmemdup(buf, strlen(buf) + 1, GFP_KERNEL);
--
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