From 1d078c9daf450ecef9dce1fcdecd45c32cb2d005 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 3 Mar 2026 00:19:33 +0000 Subject: 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 --- util/nvmutil/nvmutil.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'util') 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 */ -- cgit v1.2.1