From: Dan Carpenter <dan.carpenter@oracle.com>
To: Len Brown <lenb@kernel.org>,
Chen@elgon.mountain, Gong <gong.chen@linux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-acpi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch 1/2] ACPI, extlog: shift wrapping bug in extlog_get_dsm()
Date: Tue, 5 Nov 2013 23:18:36 +0300 [thread overview]
Message-ID: <20131105201836.GA3949@elgon.mountain> (raw)
obj->buffer.pointer is a u8 pointer so we need to cast it to u64 for the
64 bit shift. Otherwise the upper bits are always zero.
I tweaked a couple nearby lines as well to avoid going over the 80
character limit.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
index a6869e1..c4d5e59 100644
--- a/drivers/acpi/acpi_extlog.c
+++ b/drivers/acpi/acpi_extlog.c
@@ -182,11 +182,9 @@ static int extlog_get_dsm(acpi_handle handle, int rev, int func, u64 *ret)
obj = (union acpi_object *)buf.pointer;
if (obj->type == ACPI_TYPE_INTEGER) {
*ret = obj->integer.value;
- } else if (obj->type == ACPI_TYPE_BUFFER) {
- if (obj->buffer.length <= 8) {
- for (i = 0; i < obj->buffer.length; i++)
- *ret |= (obj->buffer.pointer[i] << (i * 8));
- }
+ } else if (obj->type == ACPI_TYPE_BUFFER && obj->buffer.length <= 8) {
+ for (i = 0; i < obj->buffer.length; i++)
+ *ret |= ((u64)obj->buffer.pointer[i] << (i * 8));
}
kfree(buf.pointer);
reply other threads:[~2013-11-05 20:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20131105201836.GA3949@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=Chen@elgon.mountain \
--cc=gong.chen@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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;
as well as URLs for NNTP newsgroup(s).