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>
This commit is contained in:
Родитель
f74290fdb3
Коммит
f63b4c971f
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче