diff options
author | Colin Ian King <colin.king@canonical.com> | 2016-03-18 18:08:01 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-03-22 03:23:00 +0300 |
commit | 4a798f508f5d0809f45c939e329e17b3eb0ffbc1 (patch) | |
tree | 66b0c18b068d71a62ee6c4ad5727815f78e10ac1 /drivers/acpi/utils.c | |
parent | bea3c377c286f4f63f67f2e061c1d8851af76b7e (diff) | |
download | linux-4a798f508f5d0809f45c939e329e17b3eb0ffbc1.tar.xz |
ACPI / util: cast data to u64 before shifting to fix sign extension
obj->buffer.pointer[i] should be cast to u64 to prevent an unintentional
sign extension. For example, if pointer[7] is 0x80, then the value
0xffffffffff000000 is or'd into mask rather than the intended value
0xff00000000000000
Detected with static analysis by CoverityScan
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index f12a72428aac..050673f0c0b3 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -692,7 +692,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs) mask = obj->integer.value; else if (obj->type == ACPI_TYPE_BUFFER) for (i = 0; i < obj->buffer.length && i < 8; i++) - mask |= (((u8)obj->buffer.pointer[i]) << (i * 8)); + mask |= (((u64)obj->buffer.pointer[i]) << (i * 8)); ACPI_FREE(obj); /* |