summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-03 00:19:33 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-03 00:20:16 +0000
commit1d078c9daf450ecef9dce1fcdecd45c32cb2d005 (patch)
treee3a530d063da6dee115a8d27f90a8a9e098b3324 /util
parent0ccb790fc01e6364d91736e235014dddbef994b6 (diff)
util/nvmutil: use fixed buffer
modern malloc implementations make the optimisation here pretty pointless. modern computers make this modification pointless. i'm not planning to run nvmutil on a VAX. openbsd removed support for it ages ago. 8KB fixed buffer is fine. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index e2e14be0..7e04cc37 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -38,6 +38,7 @@ uint16_t word(int, int);
#define SIZE_16KB 0x4000
#define SIZE_128KB 0x20000
+uint8_t buf[SIZE_8KB];
uint16_t mac[3] = {0, 0, 0};
ssize_t nf;
size_t partsize;
@@ -197,11 +198,6 @@ nvmalloc(void)
if ((cmd == cmd_copy) || (cmd == cmd_setchecksum) || (cmd == cmd_brick))
do_read[part ^ 1] = 0;
- /* only allocate one block if only one part being read */
- uint8_t *buf = (uint8_t *) malloc(nf << (do_read[0] & do_read[1]));
- if (buf == NULL)
- err(errno, NULL);
-
gbe[0] = buf;
/* speedhack: for cmd copy, both pointers are set the same */