Project

General

Profile

Bug #8248

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

Added by Toomas Soome over 2 years ago. Updated about 2 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:

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'

History

#1

Updated by Toomas Soome about 2 years ago

  • Description updated (diff)
#2

Updated by Electric Monk about 2 years ago

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

git commit 44b94201113baeac54736e6ea488566d4a01ce48

commit  44b94201113baeac54736e6ea488566d4a01ce48
Author: Toomas Soome <tsoome@me.com>
Date:   2017-07-26T21:07:43.000Z

    8248 dboot: dboot_startkern.c should be more consistent about type casts
    Reviewed by: Yuri Pankov <yuripv@gmx.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF