shithub: riscv

Download patch

ref: 4e5b596bbaa4a7b6114df0c293622ebf4fb94bef
parent: 66b1a83b7468fe35e11996ca1b12d00fe41f75c5
author: cinap_lenrek <[email protected]>
date: Sun May 22 17:52:04 EDT 2016

efi: ensure 8 byte alignment of buffer, as ReadBlocks() method will fail otherwise

--- a/sys/src/boot/efi/iso.c
+++ b/sys/src/boot/efi/iso.c
@@ -171,9 +171,10 @@
 static void*
 isoopen(char *path)
 {
-	static Extend ex[1];
+	static uchar buf[sizeof(Extend)+8];
+	Extend *ex = (Extend*)((uintptr)(buf+7)&~7);
 
-	if(isowalk(ex,  path))
+	if(isowalk(ex, path))
 		return nil;
 	return ex;
 }
--- a/sys/src/boot/efi/pxe.c
+++ b/sys/src/boot/efi/pxe.c
@@ -306,7 +306,8 @@
 static void*
 pxeopen(char *name)
 {
-	static Tftp t[1];
+	static uchar buf[sizeof(Tftp)+8];
+	Tftp *t = (Tftp*)((uintptr)(buf+7)&~7);
 
 	memset(t, 0, sizeof(Tftp));