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: Susheel Khiani <skhiani@codeaurora.org>
This commit is contained in:
parent
2f6130c61d
commit
8e3a1a07e3
1 changed files with 6 additions and 4 deletions
|
@ -145,7 +145,7 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx,
|
||||||
for_each_zone_zonelist(zone, zoneref, zonelist, MAX_NR_ZONES) {
|
for_each_zone_zonelist(zone, zoneref, zonelist, MAX_NR_ZONES) {
|
||||||
zone_idx = zonelist_zone_idx(zoneref);
|
zone_idx = zonelist_zone_idx(zoneref);
|
||||||
if (zone_idx == ZONE_MOVABLE) {
|
if (zone_idx == ZONE_MOVABLE) {
|
||||||
if (!use_cma_pages)
|
if (!use_cma_pages && other_free)
|
||||||
*other_free -=
|
*other_free -=
|
||||||
zone_page_state(zone, NR_FREE_CMA_PAGES);
|
zone_page_state(zone, NR_FREE_CMA_PAGES);
|
||||||
continue;
|
continue;
|
||||||
|
@ -160,7 +160,8 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx,
|
||||||
NR_FILE_PAGES)
|
NR_FILE_PAGES)
|
||||||
- zone_page_state(zone, NR_SHMEM);
|
- zone_page_state(zone, NR_SHMEM);
|
||||||
} else if (zone_idx < classzone_idx) {
|
} else if (zone_idx < classzone_idx) {
|
||||||
if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0)) {
|
if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0) &&
|
||||||
|
other_free) {
|
||||||
if (!use_cma_pages) {
|
if (!use_cma_pages) {
|
||||||
*other_free -= min(
|
*other_free -= min(
|
||||||
zone->lowmem_reserve[classzone_idx] +
|
zone->lowmem_reserve[classzone_idx] +
|
||||||
|
@ -173,8 +174,9 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx,
|
||||||
zone->lowmem_reserve[classzone_idx];
|
zone->lowmem_reserve[classzone_idx];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*other_free -=
|
if (other_free)
|
||||||
zone_page_state(zone, NR_FREE_PAGES);
|
*other_free -=
|
||||||
|
zone_page_state(zone, NR_FREE_PAGES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue