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>
This commit is contained in:
Leah Rowe
2026-03-03 00:19:33 +00:00
parent 0ccb790fc0
commit 1d078c9daf

View File

@@ -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 */