git: 9front

Download patch

ref: 5c713cb8ecbffeadf71ac3a7aa44b75ab76e1895
parent: 7552c163c9697c8ee0e930f7ea13d88b6df16759
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Sep 29 17:19:12 EDT 2017

9boot: limit read size to 4K for efi simple file system protocol

copying files from the uefi shell works, reading plan9.ini works,
loading the kernel by calling Read to read in the DATA section of
the kernel *FAILS*. my guess is that uefi filesystem driver or
nvme driver tries to allocate a temporary buffer and hasnt got
the space. limiting the read size fixes it.

--- a/sys/src/boot/efi/fs.c
+++ b/sys/src/boot/efi/fs.c
@@ -71,7 +71,7 @@
 {
 	UINTN size;
 
-	size = len;
+	size = len > 4096 ? 4096 : len;
 	if(eficall(((EFI_FILE_PROTOCOL*)f)->Read, f, &size, data))
 		return 0;
 	return (int)size;
--