From: Eugene Syromyatnikov Date: Wed, 21 Sep 2016 03:12:01 +0000 (+0300) Subject: quota: add packed attribute to struct if_dqblk definition X-Git-Tag: v4.14~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46b89571f57a315031ded1f960e4c9e5843f16a4;p=strace quota: add packed attribute to struct if_dqblk definition Since the only difference between 32-bit and 64-bit environments regarding this structure is its padding, lets just add packed attribute to its definition instead of going full mpers. * quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED. --- diff --git a/quota.c b/quota.c index 62792cd1..7fec1ccd 100644 --- a/quota.c +++ b/quota.c @@ -49,6 +49,12 @@ #include "xlat/if_dqinfo_flags.h" #include "xlat/if_dqinfo_valid.h" +/* + * We add attribute packed due to the fact that the structure is 8-byte aligned + * on 64-bit systems and therefore has additional 4 bytes of padding, which + * leads to problems when it is used on 32-bit tracee which does not have such + * padding. + */ struct if_dqblk { uint64_t dqb_bhardlimit; @@ -60,7 +66,7 @@ struct if_dqblk uint64_t dqb_btime; uint64_t dqb_itime; uint32_t dqb_valid; -}; +} ATTRIBUTE_PACKED; struct if_nextdqblk { uint64_t dqb_bhardlimit;