Use __predict_false on some fortify methods.
Give the compiler some hints that these error conditions
are unlikely to occur in practice.
Change-Id: Ifaf7322a12120ef663c8315c1a18c2dcbe4bda23
diff --git a/libc/bionic/__strcpy_chk.cpp b/libc/bionic/__strcpy_chk.cpp
index bfb6642..5aa0e93 100644
--- a/libc/bionic/__strcpy_chk.cpp
+++ b/libc/bionic/__strcpy_chk.cpp
@@ -44,7 +44,7 @@
extern "C" char *__strcpy_chk (char *dest, const char *src, size_t dest_len) {
// TODO: optimize so we don't scan src twice.
size_t src_len = strlen(src) + 1;
- if (src_len > dest_len) {
+ if (__predict_false(src_len > dest_len)) {
__fortify_chk_fail("strcpy buffer overflow",
BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW);
}