From: Eric Sandeen <sandeen@sandeen.net>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/4] xfs_logprint: fix some unaligned accesses
Date: Fri, 9 Oct 2015 08:48:08 -0500 [thread overview]
Message-ID: <5617C598.6010009@sandeen.net> (raw)
In-Reply-To: <20151009132440.GD27982@bfoster.bfoster>
On 10/9/15 8:24 AM, Brian Foster wrote:
> On Thu, Oct 08, 2015 at 07:25:50PM -0500, Eric Sandeen wrote:
>> This routine had a fair bit of gyration to avoid unaligned accesses,
>> but didn't fix them all. Fix some more spotted at runtime by libubsan.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>> logprint/log_misc.c | 18 +++++++++++++++---
>> repair/btree.c | 1 +
>> 2 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/logprint/log_misc.c b/logprint/log_misc.c
>> index d76145c..6cd249a 100644
>> --- a/logprint/log_misc.c
>> +++ b/logprint/log_misc.c
>> @@ -325,7 +325,11 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
>> }
>> super_block = 0;
>> } else if (be32_to_cpu(*(__be32 *)(*ptr)) == XFS_AGI_MAGIC) {
>> - agi = (xfs_agi_t *)(*ptr);
>> + struct xfs_agi agi_s;
>> +
>> + /* memmove because *ptr may not be 8-byte aligned */
>> + memmove(&agi_s, *ptr, sizeof(struct xfs_agi));
>> + agi = &agi_s;
>
> Nit: could we either define the new variables in the same scope as the
> pointer (either here or at the top of the function), or just ditch the
> pointers altogether?
Let me see how that looks, sure.
>> printf(_("AGI Buffer: XAGI "));
>> /*
>> * v4 filesystems only contain the fields before the uuid.
> ...
>> diff --git a/repair/btree.c b/repair/btree.c
>> index 66fb40b..e31e67a 100644
>> --- a/repair/btree.c
>> +++ b/repair/btree.c
>> @@ -230,6 +230,7 @@ btree_get_next(
>> }
>> if (level == 0) {
>> if (key) {
>> + /* XXXX what if index past MAX? What if no next? */
>
> Unintentional hunk?
Yeah, dammit, I thought I removed that, sorry.
Thanks,
-Eric
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-10-09 13:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 0:23 [PATCH 0/4] fix (mostly) minor nits spotted by gcc sanitization Eric Sandeen
2015-10-09 0:24 ` [PATCH 1/4] libxfs: avoid negative (and full-width) shifts in radix-tree.c Eric Sandeen
2015-10-09 13:23 ` Brian Foster
2015-10-09 0:25 ` [PATCH 2/4] xfs_repair: fix unaligned accesses Eric Sandeen
2015-10-09 13:24 ` Brian Foster
2015-10-09 14:03 ` Eric Sandeen
2015-10-11 22:26 ` Dave Chinner
2015-10-12 1:33 ` Eric Sandeen
2015-10-12 21:31 ` Eric Sandeen
2015-10-12 21:45 ` Dave Chinner
2015-10-13 0:32 ` Dave Chinner
2015-10-09 0:25 ` [PATCH 3/4] xfs_logprint: fix some " Eric Sandeen
2015-10-09 13:24 ` Brian Foster
2015-10-09 13:48 ` Eric Sandeen [this message]
2015-10-09 0:27 ` [PATCH 4/4] xfs_repair: fix left-shift overflows Eric Sandeen
2015-10-09 13:24 ` Brian Foster
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=5617C598.6010009@sandeen.net \
--to=sandeen@sandeen.net \
--cc=bfoster@redhat.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox