Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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: