Project

General

Profile

Actions

Bug #12154

closed

loader: readudp() does convert pointers with different alignment

Added by Toomas Soome over 2 years ago. Updated over 2 years 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.

Actions

Also available in: Atom PDF