Project

General

Profile

Bug #11587

loader.efi: comparison is always true due to limited range of data type

Added by Toomas Soome 27 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
bootloader
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Medium
Tags:

Description

Build errors with warnings enabled:

    ../copy.c: In function 'efi_copyin':
    ../copy.c:209:14: error: comparison is always true due to limited range of data type [-Werror=type-limits]
      209 |  assert(dest < 0x100000000);
          |              ^
    ../../../../../include/assert.h:54:21: note: in definition of macro 'assert'
       54 | #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
          |                     ^
    ../copy.c: In function 'efi_copyout':
    ../copy.c:217:13: error: comparison is always true due to limited range of data type [-Werror=type-limits]
      217 |  assert(src < 0x100000000);
          |             ^
    ../../../../../include/assert.h:54:21: note: in definition of macro 'assert'
       54 | #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
          |                     ^
    cc1: all warnings being treated as errors

Replace 0x100000000 (which is UINT32_MAX + 1) by UINT32_MAX, this way we will satisfy both 64-and 32-bit build.

Also available in: Atom PDF