diff options
author | Peter Jones <pjones@redhat.com> | 2018-06-11 13:41:05 -0400 |
---|---|---|
committer | Nigel Croxon <ncroxon@redhat.com> | 2023-03-28 08:38:37 -0400 |
commit | 1b94cff100b7165116715a5a0f6b22ef8f3f6ba6 (patch) | |
tree | 725af95a7ef511566f45b5ca25a4e46577001493 | |
parent | 3d82853ffe4a767275bdfaac3921704b1eb659f3 (diff) | |
download | gnu-efi-1b94cff100b7165116715a5a0f6b22ef8f3f6ba6.tar.gz |
Fix a minor coverity complaint in some apps
Coverity added a new kind of check, and it noticed some minor errors
with some types in two of the apps here, both of the same form:
1. gnu-efi-3.0.6/apps/lfbgrid.c:91: overflow_before_widen: Potentially
overflowing expression "info->VerticalResolution *
info->PixelsPerScanLine" 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).
1. gnu-efi-3.0.6/apps/bltgrid.c:67: overflow_before_widen: Potentially
overflowing expression "info->VerticalResolution *
info->HorizontalResolution" 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).
This resolves both issues.
Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r-- | apps/bltgrid.c | 3 | ||||
-rw-r--r-- | apps/lfbgrid.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/apps/bltgrid.c b/apps/bltgrid.c index 4500fbb..ff69753 100644 --- a/apps/bltgrid.c +++ b/apps/bltgrid.c @@ -64,7 +64,8 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) if (CompareMem(info, gop->Mode->Info, sizeof (*info))) continue; - NumPixels = info->VerticalResolution * info->HorizontalResolution; + NumPixels = (UINTN)info->VerticalResolution + * (UINTN)info->HorizontalResolution; BufferSize = NumPixels * sizeof(UINT32); PixelBuffer = AllocatePool(BufferSize); diff --git a/apps/lfbgrid.c b/apps/lfbgrid.c index 8a5c6bd..3914313 100644 --- a/apps/lfbgrid.c +++ b/apps/lfbgrid.c @@ -88,7 +88,8 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) if (CompareMem(info, gop->Mode->Info, sizeof (*info))) continue; - NumPixels = info->VerticalResolution * info->PixelsPerScanLine; + NumPixels = (UINTN)info->VerticalResolution + * (UINTN)info->PixelsPerScanLine; BufferSize = NumPixels * sizeof(UINT32); if (BufferSize == gop->Mode->FrameBufferSize) { CopySize = BufferSize; |