From 6bd1a1fe3ec12e177278303e6db0c79b1a14b631 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Thu, 30 Nov 2017 18:43:56 +1100 Subject: fix high memory usage during any operation with '--buffer' The --buffer command line option was passed to setvbuf(3). Computers are fast enough and libc is good enough that we realistically do not need this. Hostboot's buildpnor.pl would pass --buffer 0x40000000 which resulted in a malloc(2GB), which would fail on systems with less than 2GB of memory because sometimes libc and the kernel are sane. So, we keep the command line option for backwards compatibility but completely ignore it. In the few places where it was used to allocate a buffer to do work in (and this was via a rather round-about way), we instead just allocate something the size of the PNOR image. Fixes: https://github.com/open-power/ffs/issues/7 Signed-off-by: Stewart Smith --- fpart/src/cmd_erase.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'fpart/src/cmd_erase.c') diff --git a/fpart/src/cmd_erase.c b/fpart/src/cmd_erase.c index c05bde5..98929d8 100644 --- a/fpart/src/cmd_erase.c +++ b/fpart/src/cmd_erase.c @@ -144,9 +144,6 @@ int command_erase(args_t * args) } } - if (__ffs_buffer(__ffs, block_size) < 0) - return -1; - RAII(void*, block, malloc(block_size), free); if (block == NULL) { ERRNO(errno); -- cgit v1.2.1