summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2013-01-15 10:43:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-21 11:44:32 -0800
commitf4a5daeef931c0c8eb2bb631ab0c1d9e829326cb (patch)
treeaf2bc75ac366dc140d144fd9c3e49a6cadea271c /drivers
parentfbcfcdf223fd323903b9e8ddc538c731d9d49f33 (diff)
firmware: make sure the fw file size is not 0
commit 4adf07fba3bd64472921a01aae0e116f9f948b77 upstream. If the requested firmware file size is 0 bytes in the filesytem, we will try to vmalloc(0), which causes a warning: vmalloc: allocation failure: 0 bytes kworker/1:1: page allocation failure: order:0, mode:0xd2 __vmalloc_node_range+0x164/0x208 __vmalloc_node+0x4c/0x58 vmalloc+0x38/0x44 _request_firmware_load+0x220/0x6b0 request_firmware+0x64/0xc8 wl18xx_setup+0xb4/0x570 [wl18xx] wlcore_nvs_cb+0x64/0x9f8 [wlcore] request_firmware_work_func+0x94/0x100 process_one_work+0x1d0/0x750 worker_thread+0x184/0x4ac kthread+0xb4/0xc0 To fix this, check whether the file size is less than or equal to zero in fw_read_file_contents(). Signed-off-by: Luciano Coelho <coelho@ti.com> Acked-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/firmware_class.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index be5f7aae75fc..3724891bb99b 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -295,7 +295,7 @@ static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf
char *buf;
size = fw_file_size(file);
- if (size < 0)
+ if (size <= 0)
return false;
buf = vmalloc(size);
if (!buf)