Commit f63b4c97 authored by Pali Rohár's avatar Pali Rohár Committed by Kalle Valo

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: default avatarPali Rohár <pali.rohar@gmail.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent f74290fd
...@@ -122,8 +122,7 @@ static int wl1251_fetch_nvs(struct wl1251 *wl) ...@@ -122,8 +122,7 @@ static int wl1251_fetch_nvs(struct wl1251 *wl)
goto out; goto out;
} }
wl->nvs_len = fw->size; wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL);
wl->nvs = kmemdup(fw->data, wl->nvs_len, GFP_KERNEL);
if (!wl->nvs) { if (!wl->nvs) {
wl1251_error("could not allocate memory for the nvs file"); wl1251_error("could not allocate memory for the nvs file");
...@@ -131,6 +130,8 @@ static int wl1251_fetch_nvs(struct wl1251 *wl) ...@@ -131,6 +130,8 @@ static int wl1251_fetch_nvs(struct wl1251 *wl)
goto out; goto out;
} }
wl->nvs_len = fw->size;
ret = 0; ret = 0;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment