All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH 2/2 V3] xfs: don't take addresses of packed xfs_rmap_key member
Date: Wed, 29 Jan 2020 12:35:21 -0600	[thread overview]
Message-ID: <06b937e3-afaf-41c0-3477-a4b1a88fee48@redhat.com> (raw)
In-Reply-To: <b44b9c6e-4c40-2670-8c38-874a79e0d066@redhat.com>

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

This happens here because of how be32_add_cpu() works; just open-code
the modification instead.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
V2: fix key-> vs rec-> derp derp thinko
V3: drop local temp variable, add comment

diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
index fc78efa52c94..c6f6a7ec6121 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.c
+++ b/fs/xfs/libxfs/xfs_rmap_btree.c
@@ -187,7 +187,9 @@ xfs_rmapbt_init_high_key_from_rec(
 	adj = be32_to_cpu(rec->rmap.rm_blockcount) - 1;
 
 	key->rmap.rm_startblock = rec->rmap.rm_startblock;
-	be32_add_cpu(&key->rmap.rm_startblock, adj);
+	/* do this manually to avoid gcc warning about alignment */
+	key->rmap.rm_startblock =
+		cpu_to_be32(be32_to_cpu(key->rmap.rm_startblock) - adj);
 	key->rmap.rm_owner = rec->rmap.rm_owner;
 	key->rmap.rm_offset = rec->rmap.rm_offset;
 	if (XFS_RMAP_NON_INODE_OWNER(be64_to_cpu(rec->rmap.rm_owner)) ||



  parent reply	other threads:[~2020-01-29 18:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 17:41 [PATCH 0/2] xfs: don't take addresses of packed structures Eric Sandeen
2020-01-29 17:43 ` [PATCH 1/2] xfs: don't take addresses of packed xfs_agfl_t member Eric Sandeen
2020-01-29 18:09   ` Christoph Hellwig
2020-01-29 18:18     ` Eric Sandeen
2020-01-29 18:28       ` Christoph Hellwig
2020-01-29 18:46         ` Eric Sandeen
2020-01-29 17:45 ` [PATCH 2/2] xfs: don't take addresses of packed xfs_rmap_key Eric Sandeen
2020-01-29 17:56   ` Darrick J. Wong
2020-01-29 18:01     ` Eric Sandeen
2020-01-29 18:15   ` [PATCH 2/2 V2] xfs: don't take addresses of packed xfs_rmap_key member Eric Sandeen
2020-01-29 18:29     ` Christoph Hellwig
2020-01-29 18:31       ` Eric Sandeen
2020-01-29 18:35     ` Eric Sandeen [this message]
2020-01-29 18:36       ` [PATCH 2/2 V3] " Christoph Hellwig
2020-02-26 18:06       ` Darrick J. Wong
2020-02-26 18:21         ` Eric Sandeen
2020-02-26 18:45           ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06b937e3-afaf-41c0-3477-a4b1a88fee48@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.