Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2006 00:13:35 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 104742 for review
Message-ID:  <200608220013.k7M0DZbi063760@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104742

Change 104742 by imp@imp_lighthouse on 2006/08/22 00:13:06

	DOSPARTOFF is 446.  This is 2 % 4, which means that attempts
	to access uint32_t elements will fail with an alignment trap.
	Cope by using memcpy and add a comment to this effect.

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#9 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#9 (text+ko) ====

@@ -342,6 +342,9 @@
 		printf("No BSD partition found\r\n");
 		return -1;
 	}
+	// Although dp_start is aligned within the disk partition structure,
+	// DOSPARTOFF is 446, which is only word (2) aligned, not longword (4)
+	// aligned.  Cope by using memcpy to fetch the start of this partition.
 	memcpy(&dsk_start, &dp[i].dp_start, 4);
 	if (drvread(sec, dsk_start + LABELSECTOR, 1))
 		return -1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608220013.k7M0DZbi063760>