Project

General

Profile

Bug #11587

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

Added by Toomas Soome 6 months ago. Updated 5 months ago.

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

100%

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.

History

#1

Updated by Electric Monk 5 months ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit cf691b2b138fb3e0396a16406094b82ec555610e

commit  cf691b2b138fb3e0396a16406094b82ec555610e
Author: Toomas Soome <tsoome@me.com>
Date:   2019-09-17T20:14:03.000Z

    11587 loader.efi: comparison is always true due to limited range of data type
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF