Merge "[Native Lint] Destination buffer is not null terminated explicitly. (strncpy)" into main am: 98ebe895e4

Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/3282994

Change-Id: Icfc5a72138a8a64fa24f1fff1261ed9b91f988db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2025-01-16 10:56:40 -08:00 committed by Automerger Merge Worker
commit da6d947875
1 changed files with 2 additions and 0 deletions

View File

@ -2910,6 +2910,7 @@ update_watermarks:
min_score_adj = pressure_after_kill_min_score; min_score_adj = pressure_after_kill_min_score;
kill_reason = PRESSURE_AFTER_KILL; kill_reason = PRESSURE_AFTER_KILL;
strncpy(kill_desc, "min watermark is breached even after kill", sizeof(kill_desc)); strncpy(kill_desc, "min watermark is breached even after kill", sizeof(kill_desc));
kill_desc[sizeof(kill_desc) - 1] = '\0';
} else if (level == VMPRESS_LEVEL_CRITICAL && events != 0) { } else if (level == VMPRESS_LEVEL_CRITICAL && events != 0) {
/* /*
* Device is too busy reclaiming memory which might lead to ANR. * Device is too busy reclaiming memory which might lead to ANR.
@ -2918,6 +2919,7 @@ update_watermarks:
*/ */
kill_reason = NOT_RESPONDING; kill_reason = NOT_RESPONDING;
strncpy(kill_desc, "device is not responding", sizeof(kill_desc)); strncpy(kill_desc, "device is not responding", sizeof(kill_desc));
kill_desc[sizeof(kill_desc) - 1] = '\0';
} else if (swap_is_low && thrashing > thrashing_limit_pct) { } else if (swap_is_low && thrashing > thrashing_limit_pct) {
/* Page cache is thrashing while swap is low */ /* Page cache is thrashing while swap is low */
kill_reason = LOW_SWAP_AND_THRASHING; kill_reason = LOW_SWAP_AND_THRASHING;