Project

General

Profile

Bug #12154

loader: readudp() does convert pointers with different alignment

Added by Toomas Soome 11 months ago. Updated 11 months ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Build error with gcc 9:

    /code/illumos-gate/usr/src/boot/lib/libstand/udp.c: In function 'readudp':
    /code/illumos-gate/usr/src/boot/lib/libstand/udp.c:149:16: warning: converting a
     packed 'struct ip' pointer (alignment 2) to a 'struct udpiphdr' pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
      149 |   ui = (struct udpiphdr *)ip;
          |                ^~~~~~~~
    In file included from /code/illumos-gate/usr/src/boot/lib/libstand/udp.c:50:
    ../../../../include/netinet/ip.h:49:8: note: defined here
       49 | struct ip {
          |        ^~
    In file included from /code/illumos-gate/usr/src/boot/lib/libstand/udp.c:53:
    ../../../../include/netinet/udp_var.h:40:8: note: defined here
       40 | struct udpiphdr {
          |        ^~~~~~~~

For workaround we use void * pointer instead.

#1

Updated by Electric Monk 11 months ago

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

git commit c0a84bfe09b82357ba0fb9ad82848c7f40aee362

commit  c0a84bfe09b82357ba0fb9ad82848c7f40aee362
Author: Toomas Soome <tsoome@me.com>
Date:   2020-01-17T06:51:37.000Z

    12154 loader: readudp() does convert pointers with different alignment
    Reviewed by: Matthias Scheler <mscheler@tintri.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

#2

Updated by Electric Monk 11 months ago

git commit 4b17cfc898cea63e80243629e599bcc540eed4c7

commit  4b17cfc898cea63e80243629e599bcc540eed4c7
Author: Toomas Soome <tsoome@me.com>
Date:   2020-01-17T07:30:44.000Z

    12154 loader: readudp() does convert pointers with different alignment (missed sizeof struct ip)
    Reviewed by: Matthias Scheler <mscheler@tintri.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF