diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2017-05-31 22:40:24 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2017-05-31 22:40:24 +0000 |
commit | c457a42be4fca72c51fdca569271b62213d01a37 (patch) | |
tree | 0ce624183fb74a6ec5d2260e6904585800e8c4d8 /source/components/utilities/utownerid.c | |
parent | 65c600c804e5a81af3a34d461312027000738994 (diff) |
Notes
Diffstat (limited to 'source/components/utilities/utownerid.c')
-rw-r--r-- | source/components/utilities/utownerid.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/components/utilities/utownerid.c b/source/components/utilities/utownerid.c index fba1d7adb084..a54513f65ae0 100644 --- a/source/components/utilities/utownerid.c +++ b/source/components/utilities/utownerid.c @@ -225,14 +225,20 @@ AcpiUtAllocateOwnerId ( break; } - if (!(AcpiGbl_OwnerIdMask[j] & (1 << k))) + /* + * Note: the UINT32 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 (!(AcpiGbl_OwnerIdMask[j] & ((UINT32) 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. */ - AcpiGbl_OwnerIdMask[j] |= (1 << k); + AcpiGbl_OwnerIdMask[j] |= ((UINT32) 1 << k); AcpiGbl_LastOwnerIdIndex = (UINT8) j; AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1); @@ -328,7 +334,7 @@ AcpiUtReleaseOwnerId ( /* Decode ID to index/offset pair */ Index = ACPI_DIV_32 (OwnerId); - Bit = 1 << ACPI_MOD_32 (OwnerId); + Bit = (UINT32) 1 << ACPI_MOD_32 (OwnerId); /* Free the owner ID only if it is valid */ |