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

Commit 911baf9e authored by Susheel Khiani's avatar Susheel Khiani Committed by Vinayak Menon
Browse files

lowmemorykiller: Do proper NULL checks



Pointer other_free is getting dereferenced without
performing proper NULL checks which may cause issue.
Do proper NULL checks at all points before dereferencing
it.

Change-Id: I88515703d64730e42598ab16136dcce4c18b099c
Signed-off-by: default avatarSusheel Khiani <skhiani@codeaurora.org>
parent 313d2ee0
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -178,8 +178,9 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx,
					NR_ZONE_INACTIVE_FILE) +
					zone_page_state(zone,
					NR_ZONE_ACTIVE_FILE);
		} else if ((zone_idx < classzone_idx) && other_free) {
			if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0)) {
		} else if (zone_idx < classzone_idx) {
			if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0) &&
			    other_free) {
				if (!use_cma_pages) {
					*other_free -= min(
					  zone->lowmem_reserve[classzone_idx] +
@@ -192,6 +193,7 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx,
					  zone->lowmem_reserve[classzone_idx];
				}
			} else {
				if (other_free)
					*other_free -=
					  zone_page_state(zone, NR_FREE_PAGES);
			}