]> git.proxmox.com Git - mirror_edk2.git/commit
DynamicTablesPkg: Fix GT Block length assignment
authorSami Mujawar <sami.mujawar@arm.com>
Tue, 9 Jul 2019 12:54:04 +0000 (13:54 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 29 Mar 2020 16:53:35 +0000 (16:53 +0000)
commit878478116ab65646cddc4e590f2440f8aefca19c
treed2cdf5799387d3455249cd37c0afe369b046e389
parent96bb6704e036a2fb66d41d4ab95e976bcaab7a82
DynamicTablesPkg: Fix GT Block length assignment

The VS2017 compiler reports 'warning C4267: '=': conversion from
'size_t' to 'UINT16', possible loss of data'.

The sizeof() operator is used to calculate the size of the
GT Block structure. The length field in the GT Block structure
is 16-bit wide. Since the return type of sizeof() operator
is size_t the VS2017 compiler reports the above warning.

To fix the warning, an explicit type cast is added. An additional
check is also performed to ensure that the calculated GT Block
length does not exceed MAX_UINT16.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c