diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2020-05-05 09:42:26 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2021-10-08 01:15:59 +0000 |
commit | 5a6dd8690100ff19cdd8072d068db260cacebc3d (patch) | |
tree | 3afd185ed767c93daba8764cc74b07d122d07bf4 | |
parent | c6bbaf794d11bc2d80b00eda20a0ce761ac9d656 (diff) | |
download | src-5a6dd8690100ff19cdd8072d068db260cacebc3d.tar.gz src-5a6dd8690100ff19cdd8072d068db260cacebc3d.zip |
As with r352446 align blocks in boot1.efi
We need to ensure the buffers are aligned before passing them to ReadBlocks.
Assume 512 bytes is enough for now.
(cherry picked from commit 3d5e12ebce94791aa0d6df3e81e7a8ac48ee4b51)
-rw-r--r-- | stand/efi/boot1/ufs_module.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/stand/efi/boot1/ufs_module.c b/stand/efi/boot1/ufs_module.c index fa0e5fc051a0..edd7918e00b6 100644 --- a/stand/efi/boot1/ufs_module.c +++ b/stand/efi/boot1/ufs_module.c @@ -73,12 +73,12 @@ dskread(void *buf, uint64_t lba, int nblk) #include "ufsread.c" -static struct dmadat __dmadat; +static struct dmadat __dmadat __aligned(512); +static char ufs_buffer[BSD_LABEL_BUFFER] __aligned(512); static int init_dev(dev_info_t* dev) { - char buffer[BSD_LABEL_BUFFER]; struct disklabel *dl; uint64_t bs; int ok; @@ -109,14 +109,14 @@ init_dev(dev_info_t* dev) * will retry fsread(0) only if there's a label found with a non-zero * offset. */ - if (dskread(buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0) + if (dskread(ufs_buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0) return (-1); dl = NULL; bs = devinfo->dev->Media->BlockSize; if (bs != 0 && bs <= BSD_LABEL_BUFFER / 2) - dl = (struct disklabel *)&buffer[bs]; + dl = (struct disklabel *)&ufs_buffer[bs]; if (dl == NULL || dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC) - dl = (struct disklabel *)&buffer[BSD_LABEL_OFFSET]; + dl = (struct disklabel *)&ufs_buffer[BSD_LABEL_OFFSET]; if (dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC || dl->d_partitions[0].p_offset == 0) return (-1); |