lmkd: fix potential NULL pointer dereference
`ki` appears to be potentially NULL. Output bogus values if it is. Caught by the static analyzer: > system/memory/lmkd/lmkd.cpp:2171:66: warning: Access to field 'kill_reason' results in a dereference of a null pointer (loaded from variable 'ki') [clang-analyzer-core.NullDereference] Bug: None Test: TreeHugger Change-Id: Iae26855528e1f7fec8f1455e06c7e813a732dc75
This commit is contained in:
parent
34928bb817
commit
e849f1414e
4
lmkd.cpp
4
lmkd.cpp
|
|
@ -2168,8 +2168,8 @@ static int kill_one_process(struct proc* procp, int min_oom_score, struct kill_i
|
|||
|
||||
mem_st = stats_read_memory_stat(per_app_memcg, pid, uid, rss_kb * 1024, swap_kb * 1024);
|
||||
|
||||
snprintf(desc, sizeof(desc), "lmk,%d,%d,%d,%d,%d", pid, (int)ki->kill_reason, procp->oomadj,
|
||||
min_oom_score, ki->max_thrashing);
|
||||
snprintf(desc, sizeof(desc), "lmk,%d,%d,%d,%d,%d", pid, ki ? (int)ki->kill_reason : -1,
|
||||
procp->oomadj, min_oom_score, ki ? ki->max_thrashing : -1);
|
||||
trace_kill_start(pid, desc);
|
||||
|
||||
/* CAP_KILL required */
|
||||
|
|
|
|||
Loading…
Reference in New Issue