aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2011-08-18 19:36:00 +0100
committerMatt Fleming <matt.fleming@intel.com>2011-08-18 20:55:56 +0100
commitadd4b59291be01a06bf7635217d648d3d98b2de8 (patch)
tree18668c48ded12cf4167bf7e4d7fffb45db3bb40c
parentc7615edf9fe977f072f7ea3287884d36343761d2 (diff)
downloadefilinux-add4b59291be01a06bf7635217d648d3d98b2de8.tar.gz
malloc: Use UINTN instead of EFI_PHYSICAL_ADDRESS for casts
EFI_PHYSICAL_ADDRESS is a 64-bit data type, which when used to cast to a 32-bit pointer leads to the following warnings, cc1: warnings being treated as errors malloc.c: In function ‘emalloc’: malloc.c:60:6: error: cast from pointer to integer of different size malloc.c:61:12: error: cast from pointer to integer of different size malloc.c:67:10: error: cast to pointer from integer of different size UINTN is a much more logical choice for this cast because it maps to unsigned long, which will Do The Right Thing for both i386 and x86-64. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--malloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/malloc.c b/malloc.c
index a4138db..8f2b18c 100644
--- a/malloc.c
+++ b/malloc.c
@@ -47,7 +47,7 @@ EFI_STATUS emalloc(UINTN size, UINTN align, EFI_PHYSICAL_ADDRESS *addr)
{
UINTN map_size, map_key, desc_size;
EFI_MEMORY_DESCRIPTOR *map_buf;
- EFI_PHYSICAL_ADDRESS d, map_end;
+ UINTN d, map_end;
UINT32 desc_version;
EFI_STATUS err;
UINTN nr_pages = EFI_SIZE_TO_PAGES(size);
@@ -57,8 +57,8 @@ EFI_STATUS emalloc(UINTN size, UINTN align, EFI_PHYSICAL_ADDRESS *addr)
if (err != EFI_SUCCESS)
goto fail;
- d = (EFI_PHYSICAL_ADDRESS)map_buf;
- map_end = (EFI_PHYSICAL_ADDRESS)map_buf + map_size;
+ d = (UINTN)map_buf;
+ map_end = (UINTN)map_buf + map_size;
for (; d < map_end; d += desc_size) {
EFI_MEMORY_DESCRIPTOR *desc;