diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 22:17:36 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 22:33:26 +0000 |
commit | b4f1a2bfe64cd0d8dc58c0b7173745f3c1af0bb3 (patch) | |
tree | b1d14313e41e0417a749f2a03fd35df338e1bf0a | |
parent | 7ffa5f8d889e8107fd97fcc5628f87e6ef2f4b91 (diff) | |
download | klibc-b4f1a2bfe64cd0d8dc58c0b7173745f3c1af0bb3.tar.gz |
[klibc] nfsmount: Fix alignment of packet structures
These structures should have alignment of exactly 4, since we want the
32-bit fields in them to have natural alignment but we don't want extra
padding that would violate the wire protocols.
This should be what happens by default, but for some reason it's
declared with the "packed" attribute. gcc is now warning about using
potentially misaligned pointers to its members.
Add the attribute "aligned(4)" so that it is definitely exactly 4-byte
aligned.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/kinit/nfsmount/mount.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr/kinit/nfsmount/mount.c b/usr/kinit/nfsmount/mount.c index e0687a6fa8fe43..ae48354b02e7b4 100644 --- a/usr/kinit/nfsmount/mount.c +++ b/usr/kinit/nfsmount/mount.c @@ -34,13 +34,13 @@ struct mount_call { struct nfs_fh_wire { uint32_t size; char data[NFS_MAXFHSIZE_WIRE]; -} __attribute__ ((packed)); +} __attribute__ ((packed, aligned(4))); struct mount_reply { struct rpc_reply reply; uint32_t status; struct nfs_fh_wire fh; -} __attribute__ ((packed)); +} __attribute__ ((packed, aligned(4))); #define MNT_REPLY_MINSIZE (sizeof(struct rpc_reply) + sizeof(uint32_t)) |