Project

General

Profile

Actions

Bug #8248

closed

dboot: dboot_startkern.c should be more consistent about type casts

Added by Toomas Soome about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2017-05-18
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The bootinfo and friends are using native_ptr_t members and the current dboot code is not very consistent about type casts.

The double casts like: (native_ptr_t)(uintptr_t) are needed with pointer, otherwise we will get error:

diff --git a/usr/src/uts/i86pc/dboot/dboot_startkern.c b/usr/src/uts/i86pc/dboot/dboot_startkern.c
index d8bfec534d..6b62be7a97 100644
--- a/usr/src/uts/i86pc/dboot/dboot_startkern.c
+++ b/usr/src/uts/i86pc/dboot/dboot_startkern.c
@@ -1080,7 +1080,7 @@ dboot_find_env(void)
                modules[0].bm_name = (native_ptr_t)(uintptr_t)NULL;
                modules[0].bm_hash = (native_ptr_t)(uintptr_t)NULL;
                modules[0].bm_type = BMT_ENV;
-               bi->bi_modules = (native_ptr_t)(uintptr_t)modules;
+               bi->bi_modules = (native_ptr_t)modules;
                bi->bi_module_cnt = 1;
                return;
        }


And the error for this change:
cc1: warnings being treated as errors
../../i86pc/dboot/dboot_startkern.c: In function 'dboot_find_env':
../../i86pc/dboot/dboot_startkern.c:1083: error: cast from pointer to integer of different size [-Wpointer-to-int-cast]
*** Error code 1
dmake: Fatal error: Command failed for target `dboot/obj64/dboot_startkern.o'
Actions

Also available in: Atom PDF