From: Vasiliy Kulikov <segooon@gmail.com>
To: kernel-janitors@vger.kernel.org
Cc: "Samuel Ortiz" <sameo@linux.intel.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: mfd: fix off by one error
Date: Sun, 10 Oct 2010 17:28:31 +0000 [thread overview]
Message-ID: <1286731711-17865-1-git-send-email-segooon@gmail.com> (raw)
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
next reply other threads:[~2010-10-10 17:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-10 17:28 Vasiliy Kulikov [this message]
2010-10-10 19:39 ` [PATCH] mfd/mc13xxx: don't open code kasprintf
2010-10-15 13:18 `
2010-10-19 10:50 ` Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286731711-17865-1-git-send-email-segooon@gmail.com \
--to=segooon@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox