Fix loading of large firmware files.
PATCH 1/1 Fix loading of large firmware files.
From: Thomas Hellstrom <[email protected]>
drivers/base/firmware_class.c +3 -1
@@ -206,7 +206,9 @@ fw_realloc_buffer(struct firmware_priv *if (min_size <= fw_priv->alloc_size)return 0 ; - new_size =ALIGN (min_size,PAGE_SIZE ); + new_size =2 * new_size; + new_size = (min_size > new_size) ? min_size : new_size; + new_size =ALIGN (new_size,PAGE_SIZE ); new_data =vmalloc (new_size);if (!new_data) {printk (KERN_ERR "%s: unable to alloc buffer\n" , __FUNCTION__);
Signature · 1 line
1.4.1
PATCH RESEND 1/1 Fix loading of large firmware files
Firmware loading has a memory allocation complexity of O(size * size), which makes loads of very large firmware files stall and fail. This patch fixes that problem by making the allocation complexity O(size * ln(size)).
Signed-off-by Thomas Hellstrom <[email protected]>
--- drivers/base/firmware_class.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/base/firmware_class.c +3 -1
@@ -206,7 +206,9 @@ fw_realloc_buffer(struct firmware_priv *if (min_size <= fw_priv->alloc_size)return 0 ; - new_size =ALIGN (min_size,PAGE_SIZE ); + new_size =2 * new_size; + new_size = (min_size > new_size) ? min_size : new_size; + new_size =ALIGN (new_size,PAGE_SIZE ); new_data =vmalloc (new_size);if (!new_data) {printk (KERN_ERR "%s: unable to alloc buffer\n" , __FUNCTION__);
Signature · 1 line
1.4.1