shithub: riscv

Download patch

ref: a9b4126468e49b662c12d2d35251443a6d7a3192
parent: 87274893d81eda9315a7441ff49928a3a6741609
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;