diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2017-11-10 02:38:23 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-02-27 16:50:42 +0300 |
commit | f63b4c971f5fb1310f145785c3b2b77651ef129e (patch) | |
tree | 345728586ddf1f300697a599beff4163e878658b /drivers/net | |
parent | f74290fdb363665538743d14c4f00aeacdb68d87 (diff) | |
download | linux-f63b4c971f5fb1310f145785c3b2b77651ef129e.tar.xz |
wl1251: Update wl->nvs_len after wl->nvs is valid
If kmemdup fails, then wl->nvs_len will contain invalid non-zero size.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ti/wl1251/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 037defd10b91..412fbd413003 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c @@ -122,8 +122,7 @@ static int wl1251_fetch_nvs(struct wl1251 *wl) goto out; } - wl->nvs_len = fw->size; - wl->nvs = kmemdup(fw->data, wl->nvs_len, GFP_KERNEL); + wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL); if (!wl->nvs) { wl1251_error("could not allocate memory for the nvs file"); @@ -131,6 +130,8 @@ static int wl1251_fetch_nvs(struct wl1251 *wl) goto out; } + wl->nvs_len = fw->size; + ret = 0; out: |