mirror_edk2/MdeModulePkg/Bus/Ata/AtaAtapiPassThru
Hao Wu 27daa8658e MdeModulePkg/AtaAtapiPassThru: Fix possible out of range left shift
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=699

Within function AhciModeInitialization(), left shift operations of 'BIT0'
in the following statements:
"if ((PortImplementBitMap & (BIT0 << Port)) != 0) {"

will incur possible out of range left shift when Port is 31, since
"1 << 31" is possible to exceed the range of type 'int' (signed).

According to the C11 spec, Section 6.5.7:
> 4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
>   bits are filled with zeros. If E1 has an unsigned type, the value
>   of the result is E1 * 2^E2 , reduced modulo one more than the
>   maximum value representable in the result type. If E1 has a signed
>   type and nonnegative value, and E1 * 2^E2 is representable in the
>   result type, then that is the resulting value; otherwise, the
>   behavior is undefined.

This commit explicitly cast 'BIT0' with UINT32 to resolve this issue.

Cc: Steven Shi <steven.shi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-09-29 16:14:17 +08:00
..
AhciMode.c MdeModulePkg/AtaAtapiPassThru: Fix possible out of range left shift 2017-09-29 16:14:17 +08:00
AhciMode.h MdeModulePkg/AtaAtapiPassThru: relax PHY detect timeout 2017-06-28 12:47:13 +00:00
AtaAtapiPassThru.c MdeModulePkg/AtaAtapiPassThru: disable the device at ExitBootServices() 2017-09-08 20:22:38 +02:00
AtaAtapiPassThru.h MdeModulePkg/AtaAtapiPassThru: disable the device at ExitBootServices() 2017-09-08 20:22:38 +02:00
AtaAtapiPassThru.inf MdeModulePkg: INF/DEC file updates to EDK II packages 2014-08-28 06:34:06 +00:00
AtaAtapiPassThruDxe.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
AtaAtapiPassThruDxeExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
ComponentName.c Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid/invalid. 2011-07-06 03:55:36 +00:00
IdeMode.c MdeModulePkg/.../IdeMode: correctly report length of returned data 2016-01-25 11:33:37 +00:00
IdeMode.h Add BlockIO2 Protocol. 2011-05-03 10:31:41 +00:00