[PATCH 2/4] xfs_repair: fix unaligned accesses
Eric Sandeen
sandeen at sandeen.net
Sun Oct 11 20:33:41 CDT 2015
On Oct 11, 2015, at 5:26 PM, Dave Chinner <david at fromorbit.com> wrote:
>
>> On Thu, Oct 08, 2015 at 07:25:24PM -0500, Eric Sandeen wrote:
>> This fixes some unaligned accesses spotted by libubsan in repair.
>>
>> Signed-off-by: Eric Sandeen <sandeen at redhat.com>
>> ---
>> repair/dinode.c | 19 +++++++++----------
>> repair/prefetch.c | 4 ++--
>> 2 files changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/repair/dinode.c b/repair/dinode.c
>> index f78f907..44bbb8f 100644
>> --- a/repair/dinode.c
>> +++ b/repair/dinode.c
>> @@ -960,13 +960,13 @@ _("bad numrecs 0 in inode %" PRIu64 " bmap btree root block\n"),
>> * btree, we'd do it right here. For now, if there's a
>> * problem, we'll bail out and presumably clear the inode.
>> */
>> - if (!verify_dfsbno(mp, be64_to_cpu(pp[i]))) {
>> + if (!verify_dfsbno(mp, get_unaligned_be64(&pp[i]))) {
>
> I don't understand - when are pointers in the BMBT not 64 bit
> aligned? The buffers are allocated by memalign to be 64 bit aligned,
> and all the internal BMBT structures are 64 bit aligned, too. i.e
> the BMBT block header is 24/72 bytes in length (depending on CRCs),
> the pointers are 64 bit, and the records are 128 bit.
>
> So where's the unaligned access coming from?
>
Hrm, I'm sure I hit it and just took it at face value, sorry - I'll run through it again and look more closely...
Thanks,
Eric
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david at fromorbit.com
>
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
More information about the xfs
mailing list