All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: mfd: fix off by one error
@ 2010-10-10 17:28 ` Vasiliy Kulikov
  0 siblings, 0 replies; 8+ messages in thread
From: Vasiliy Kulikov @ 2010-10-10 17:28 UTC (permalink / raw)
  To: kernel-janitors; +Cc: Samuel Ortiz, Uwe Kleine-König, linux-kernel

snprintf() is overflowed iff result is greater or equal than
argument "size".

Signed-off-by: Vasiliy Kulikov <segooon@gmail.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


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

end of thread, other threads:[~2010-10-19 10:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 17:28 [PATCH] drivers: mfd: fix off by one error Vasiliy Kulikov
2010-10-10 17:28 ` Vasiliy Kulikov
2010-10-10 19:39 ` [PATCH] mfd/mc13xxx: don't open code kasprintf 
2010-10-10 19:39   ` Uwe Kleine-König
2010-10-15 13:18   ` 
2010-10-15 13:18     ` Uwe Kleine-König
2010-10-19 10:50   ` Samuel Ortiz
2010-10-19 10:50     ` Samuel Ortiz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.