summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-01-25 06:23:22 +0000
committerLeah Rowe <leah@libreboot.org>2025-01-25 06:23:22 +0000
commited45da9cae530925a5bc633ed080a6a04fb3c7dd (patch)
tree3a8113a8b593b8df8c6fc28236bfaa7e82fde985
parentec3148dc3b5d4fd392ef9cbfe31051e54503768e (diff)
util/nvmutil: Remove unnecessary buffer
The buf variable is only used once, and only so that we can get a pointer. We can point to buf16 instead, for the same result. The gbe pointer (size_t) is later converter to a char * when writing back to the file. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index c2839c45..7662e446 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -32,7 +32,6 @@ uint8_t hextonum(char chs), rhex(void);
#define SIZE_128KB 0x20000
uint16_t buf16[SIZE_64KB], mac[3] = {0, 0, 0};
-uint8_t *buf = (uint8_t *) &buf16;
size_t partsize, nf, gbe[2];
uint8_t nvmPartChanged[2] = {0, 0}, skipread[2] = {0, 0};
int e = 1, flags, rfd, fd, part, gbeFileChanged = 0;
@@ -208,7 +207,7 @@ readGbe(void)
skipread[part ^ 1] = 1; /* only read the user-specified part */
/* we pread per-part, so each part has its own pointer: */
- gbe[0] = (size_t) buf;
+ gbe[0] = (size_t) buf16;
gbe[1] = gbe[0] + partsize;
for (int p = 0; p < 2; p++) {