klibc-bot for Ben Hutchings
2020-Mar-28 22:36 UTC
[klibc] [klibc:master] nfsmount: Fix alignment of packet structures
Commit-ID: b4f1a2bfe64cd0d8dc58c0b7173745f3c1af0bb3 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=b4f1a2bfe64cd0d8dc58c0b7173745f3c1af0bb3 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Sat, 28 Mar 2020 22:17:36 +0000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 22:33:26 +0000 [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 at decadent.org.uk> --- usr/kinit/nfsmount/mount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/kinit/nfsmount/mount.c b/usr/kinit/nfsmount/mount.c index e0687a6f..ae48354b 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))