svn commit: r305814 - head/sys/boot/common
Emmanuel Vadot
manu at FreeBSD.org
Wed Sep 14 17:43:34 UTC 2016
Author: manu
Date: Wed Sep 14 17:43:32 2016
New Revision: 305814
URL: https://svnweb.freebsd.org/changeset/base/305814
Log:
ufsread: Do not cast struct direct from void *
This cause alignment problem on ARM (and possibly other archs), instead copy it.
MFC after: 1 week
Modified:
head/sys/boot/common/ufsread.c
Modified: head/sys/boot/common/ufsread.c
==============================================================================
--- head/sys/boot/common/ufsread.c Wed Sep 14 16:47:17 2016 (r305813)
+++ head/sys/boot/common/ufsread.c Wed Sep 14 17:43:32 2016 (r305814)
@@ -97,21 +97,21 @@ static __inline uint8_t
fsfind(const char *name, ufs_ino_t * ino)
{
static char buf[DEV_BSIZE];
- struct direct *d;
+ static struct direct d;
char *s;
ssize_t n;
fs_off = 0;
while ((n = fsread(*ino, buf, DEV_BSIZE)) > 0)
for (s = buf; s < buf + DEV_BSIZE;) {
- d = (void *)s;
+ memcpy(&d, s, sizeof(struct direct));
if (ls)
- printf("%s ", d->d_name);
- else if (!strcmp(name, d->d_name)) {
- *ino = d->d_ino;
- return d->d_type;
+ printf("%s ", d.d_name);
+ else if (!strcmp(name, d.d_name)) {
+ *ino = d.d_ino;
+ return d.d_type;
}
- s += d->d_reclen;
+ s += d.d_reclen;
}
if (n != -1 && ls)
printf("\n");
More information about the svn-src-all
mailing list