diff options
author | marius <marius@FreeBSD.org> | 2007-10-21 17:03:18 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2007-10-21 17:03:18 +0000 |
commit | 4d2f5e9e2eb6e3034120a575d42c2f45bdc3247f (patch) | |
tree | 671044c373199adf7fe9a4d6be7ab8d5644d5a51 /lib/libstand/tftp.c | |
parent | beb293fc6857f9904ecb14cd5f8e42f8a36f7b8c (diff) | |
download | FreeBSD-src-4d2f5e9e2eb6e3034120a575d42c2f45bdc3247f.zip FreeBSD-src-4d2f5e9e2eb6e3034120a575d42c2f45bdc3247f.tar.gz |
- Given that we tell the compiler that struct ip is packed and 32-bit
aligned, GCC 4.2.1 also generates code for sendudp() that assumes
this alignment. GCC 4.2.1 however doesn't 32-bit align wbuf, causing
the loader to crash due to an unaligned access of wbuf in sendudp()
when netbooting sparc64. Solve this by specifying wbuf as packed and
32-bit aligned, too. As for lastdata and readudp() this currently is
no issue when compiled with GCC 4.2.1, though give lastdata the same
treatment as wbuf for consistency and possibility of being affected
in the future. [1]
- Sprinkle const on a lookup table.
Reported by: marcel [1]
Submitted by: yongari [1]
Reviewed by: marcel [1]
MFC after: 5 days
Diffstat (limited to 'lib/libstand/tftp.c')
-rw-r--r-- | lib/libstand/tftp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c index 0cbfa52..fd1b4ee 100644 --- a/lib/libstand/tftp.c +++ b/lib/libstand/tftp.c @@ -95,10 +95,10 @@ struct tftp_handle { u_char header[HEADER_SIZE]; struct tftphdr t; u_char space[RSPACE]; - } lastdata; + } __packed __aligned(4) lastdata; }; -static int tftperrors[8] = { +static const int tftperrors[8] = { 0, /* ??? */ ENOENT, EPERM, @@ -175,7 +175,7 @@ tftp_makereq(h) u_char header[HEADER_SIZE]; struct tftphdr t; u_char space[FNAME_SIZE + 6]; - } wbuf; + } __packed __aligned(4) wbuf; char *wtail; int l; ssize_t res; @@ -218,7 +218,7 @@ tftp_getnextblock(h) struct { u_char header[HEADER_SIZE]; struct tftphdr t; - } wbuf; + } __packed __aligned(4) wbuf; char *wtail; int res; struct tftphdr *t; |