[PATCH 1/2] xfs: don't take addresses of packed xfs_agfl_t member

Eric Sandeen
2020-01-29T17:43:19Z

gcc now warns about taking an address of a packed structure member.

Work around this by using offsetof() instead.

Thanks to bfoster for the suggestion and djwong for reiterating it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 1b7dcbae051c..7bfc8e2437e9 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -787,7 +787,8 @@ typedef struct xfs_agi {

#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
- &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
+ (__be32 *)((char *)(bp)->b_addr + \
+ offsetof(struct xfs_agfl, agfl_bno)) : \
(__be32 *)(bp)->b_addr)

typedef struct xfs_agfl {