shithub: riscv

Download patch

ref: 599fe05b17e25a3c7028f9aa296a7fb5face2882
parent: ff0da68f6efbea6c53474de033436a0cc8ff3583
author: Jacob Moody <moody@posixcafe.org>
date: Fri Jul 7 15:17:52 EDT 2023

hjfs: unlimited buffer works

Due to malloc cap, a buffer above 2G
would cause malloc to fail. This caused
inst/mounthjfs to error if the system had
over ~8G of ram.

--- a/sys/src/cmd/hjfs/buf.c
+++ b/sys/src/cmd/hjfs/buf.c
@@ -240,7 +240,9 @@
 	Buf *b;
 
 	fmtinstall('T', Tfmt);
-	b = emalloc(sizeof(*b) * nbuf);
+	b = sbrk(sizeof(*b) * (vlong)nbuf);
+	if(b == (void*)-1)
+		sysfatal("sbrk: %r");
 	bfree.fnext = bfree.fprev = &bfree;
 	while(nbuf--)
 		markfree(b++);