Date: Wed, 14 Sep 2016 17:43:33 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305814 - head/sys/boot/common Message-ID: <201609141743.u8EHhX7R038840@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609141743.u8EHhX7R038840>