]> git.ipfire.org Git - thirdparty/systemd.git/commit
boot: avoid 32-bit calculation for a 64-bit lvalue
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 Mar 2019 13:16:40 +0000 (14:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Mar 2019 12:32:45 +0000 (13:32 +0100)
commit7a2cb0228c2f1b7d95f6be7a751d1074d03e9cb5
tree93581f83d1e44975dafe1bc465ced907b10260a6
parentff19ad888d2a7a9f390e492841763d5b8d1061c4
boot: avoid 32-bit calculation for a 64-bit lvalue

Coverity CID#1399116:
> Potentially overflowing expression
> gpt_header_buffer.gpt_header.SizeOfPartitionEntry * gpt_header_buffer.gpt_header.NumberOfPartitionEntries
> with type unsigned int (32 bits, unsigned) is evaluated using 32-bit
> arithmetic, and then used in a context that expects an expression of type
> UINTN (64 bits, unsigned).

Let's import the ALIGN_TO macro to sd-boot and use it to avoid the issue.
src/boot/efi/boot.c
src/boot/efi/util.h