diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-11-30 18:43:56 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-11-30 18:52:23 +1100 |
commit | 6bd1a1fe3ec12e177278303e6db0c79b1a14b631 (patch) | |
tree | 18cd0e0f28e71e089962eda1741a12cb4d93d8ce /fcp/src/cmd_read.c | |
parent | 1ccd69266b2b71113d17de0d799e0de64aac2fb5 (diff) | |
download | ffs-6bd1a1fe3ec12e177278303e6db0c79b1a14b631.tar.gz ffs-6bd1a1fe3ec12e177278303e6db0c79b1a14b631.zip |
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 <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'fcp/src/cmd_read.c')
-rw-r--r-- | fcp/src/cmd_read.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/fcp/src/cmd_read.c b/fcp/src/cmd_read.c index 0745c21..2f183d7 100644 --- a/fcp/src/cmd_read.c +++ b/fcp/src/cmd_read.c @@ -83,14 +83,6 @@ static int __read(args_t * args, off_t offset, entry_list_t * done_list) if (__ffs_info(ffs, FFS_INFO_BLOCK_SIZE, &block_size) < 0) return -1; - if (args->buffer != NULL) { - uint32_t buffer; - if (parse_size(args->buffer, &buffer) < 0) - return -1; - if (__ffs_buffer(ffs, buffer) < 0) - return -1; - } - ffs_entry_t entry; if (__ffs_entry_find(ffs, name, &entry) == false) { UNEXPECTED("partition entry '%s' not found\n", name); |