[Bug 237940] struct nvme_health_information_page{} @ /usr/include/dev/nvme/nvme.h has alignment issues.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri May 17 08:19:59 UTC 2019


            Bug ID: 237940
           Summary: struct nvme_health_information_page{} @
                    /usr/include/dev/nvme/nvme.h has alignment issues.
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: root+FreeBSD at linuxpedia.pl

struct nvme_health_information_page {

        uint8_t                 critical_warning;
        uint16_t                temperature;
        uint8_t                 available_spare;
/* ... */
} __packed __aligned(4);

has issues with alignment: `temperature` field can't be properly aligned on any
current architecture which seems to defeat the `__aligned(4)` hint.

What has bitten me today is that it confuses some code-generating tools, like
Rust's bindgen. I already filed a bug to them, as they treat __packed
__aligned(4) as __packed(4) - which has a *totally* different meaning -  but it
would be nice to have some BSD compiler guru took a glimpse at this particular
structure and shed some light on whether __aligned(4) is OK here. 

And yes, I know this structure layout is not BSD's idea ¯\_(ツ)_/¯

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list