summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-04-26 12:25:33 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-04-26 12:25:33 (GMT)
commit6646de02148cecdc1b97a999b10eaa930d9cfca5 (patch)
treec8c5b2c3884b19c5807ded1339e3652f0b386fbb
parent3963d943f8a9b4ef89f000b5e1424e63dba920f5 (diff)
downloadbusybox-6646de02148cecdc1b97a999b10eaa930d9cfca5.tar.gz
busybox-6646de02148cecdc1b97a999b10eaa930d9cfca5.tar.bz2
dnsd: fix unaligned access problem
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/dnsd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c
index c76a54f..1a99040 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -44,10 +44,15 @@ struct dns_head {
uint16_t nauth;
uint16_t nadd;
};
+/* Structure used to access type and class fields.
+ * They are totally unaligned, but gcc 4.3.4 thinks that pointer of type uint16_t*
+ * is 16-bit aligned and replaces 16-bit memcpy (in move_from_unaligned16 macro)
+ * with aligned halfword access on arm920t!
+ * Oh well. Slapping PACKED everywhere seems to help: */
struct type_and_class {
- uint16_t type;
- uint16_t class;
-};
+ uint16_t type PACKED;
+ uint16_t class PACKED;
+} PACKED;
/* element of known name, ip address and reversed ip address */
struct dns_entry {
struct dns_entry *next;