summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorErik Schmauss <erik.schmauss@intel.com>2017-06-05 16:40:15 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-12 14:58:41 +0200
commitdeb85f6c8a4870c7372d36cf26b73f9a35bfd81a (patch)
tree765f983d0690631acc7d463fc3e4cdc640e5a7ae /drivers/acpi/acpica
parent5e2d9e919f5c785879e35e4686758c36542ccaa9 (diff)
downloadlinux-deb85f6c8a4870c7372d36cf26b73f9a35bfd81a.tar.gz
linux-deb85f6c8a4870c7372d36cf26b73f9a35bfd81a.tar.xz
ACPICA: Explicitly cast 1 to u32
ACPICA commit 4091360d6526c8d4f1e6bccb6b1c3123bda9ac33 The runtime errors caused when acpica tools are compiled with -fsanitize=shift imply that these 1s are stored in integers. This cast insures that 1 is stored in unsigned integers. Link: https://github.com/acpica/acpica/commit/4091360d Signed-off-by: Erik Schmauss <erik.schmauss@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/utownerid.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c
index c82399f9b456..1b3ee74a87eb 100644
--- a/drivers/acpi/acpica/utownerid.c
+++ b/drivers/acpi/acpica/utownerid.c
@@ -104,13 +104,19 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id *owner_id)
break;
}
- if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) {
+ /*
+ * Note: the u32 cast ensures that 1 is stored as a unsigned
+ * integer. Omitting the cast may result in 1 being stored as an
+ * int. Some compilers or runtime error detection may flag this as
+ * an error.
+ */
+ if (!(acpi_gbl_owner_id_mask[j] & ((u32)1 << k))) {
/*
* Found a free ID. The actual ID is the bit index plus one,
* making zero an invalid Owner ID. Save this as the last ID
* allocated and update the global ID mask.
*/
- acpi_gbl_owner_id_mask[j] |= (1 << k);
+ acpi_gbl_owner_id_mask[j] |= ((u32)1 << k);
acpi_gbl_last_owner_id_index = (u8)j;
acpi_gbl_next_owner_id_offset = (u8)(k + 1);
@@ -201,7 +207,7 @@ void acpi_ut_release_owner_id(acpi_owner_id *owner_id_ptr)
/* Decode ID to index/offset pair */
index = ACPI_DIV_32(owner_id);
- bit = 1 << ACPI_MOD_32(owner_id);
+ bit = (u32)1 << ACPI_MOD_32(owner_id);
/* Free the owner ID only if it is valid */