From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Margarita Olaya Cabrera <magi@slimlogic.co.uk>,
Liam Girdwood <lrg@ti.com>, Samuel Ortiz <sameo@linux.intel.com>
Subject: [PATCH] mfd: Fix off-by-one value range checking for tps65912_i2c_write
Date: Fri, 24 Jun 2011 22:37:57 +0800 [thread overview]
Message-ID: <1308926277.2628.6.camel@phoenix> (raw)
>From c5124060f13296bfc8cbbbb8298cf4b9b1faa1e9 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@gmail.com>
Date: Fri, 24 Jun 2011 15:34:16 +0800
Subject: [PATCH] mfd: Fix off-by-one value range checking for tps65912_i2c_write
If bytes == (TPS6591X_MAX_REGISTER + 1), we have a buffer overflow when
doing memcpy(&msg[1], src, bytes).
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/tps65912-i2c.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c
index 9ed123a..c041f2c 100644
--- a/drivers/mfd/tps65912-i2c.c
+++ b/drivers/mfd/tps65912-i2c.c
@@ -57,7 +57,7 @@ static int tps65912_i2c_write(struct tps65912 *tps65912, u8 reg,
u8 msg[TPS6591X_MAX_REGISTER + 1];
int ret;
- if (bytes > (TPS6591X_MAX_REGISTER + 1))
+ if (bytes > TPS6591X_MAX_REGISTER)
return -EINVAL;
msg[0] = reg;
--
1.7.4.1
next reply other threads:[~2011-06-24 14:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 14:37 Axel Lin [this message]
2011-07-04 15:23 ` [PATCH] mfd: Fix off-by-one value range checking for tps65912_i2c_write 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=1308926277.2628.6.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=magi@slimlogic.co.uk \
--cc=sameo@linux.intel.com \
/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 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.