fortify: remove last uses of __bos_trivially_not*
Since we're using the gt/ge ones a lot now, having `not` versions probably just adds to confusion. Swap out their remaining uses and delete them. Bug: 141267932 Test: m checkbuild on internal-master Change-Id: I2107ae65007a4995e4fa23371fefe4db7547f43b
This commit is contained in:
parent
fd1ff4b2c8
commit
3aedee9828
3 changed files with 4 additions and 10 deletions
|
@ -46,7 +46,7 @@ __BIONIC_FORTIFY_INLINE
|
|||
void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
|
||||
__overloadable {
|
||||
size_t bos_dst = __bos0(dst);
|
||||
if (__bos_trivially_not_lt(bos_dst, copy_amount)) {
|
||||
if (__bos_trivially_ge(bos_dst, copy_amount)) {
|
||||
return __builtin_memcpy(dst, src, copy_amount);
|
||||
}
|
||||
return __builtin___memcpy_chk(dst, src, copy_amount, bos_dst);
|
||||
|
@ -56,7 +56,7 @@ void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_a
|
|||
__BIONIC_FORTIFY_INLINE
|
||||
void* memmove(void* const dst __pass_object_size0, const void* src, size_t len) __overloadable {
|
||||
size_t bos_dst = __bos0(dst);
|
||||
if (__bos_trivially_not_lt(bos_dst, len)) {
|
||||
if (__bos_trivially_ge(bos_dst, len)) {
|
||||
return __builtin_memmove(dst, src, len);
|
||||
}
|
||||
return __builtin___memmove_chk(dst, src, len, bos_dst);
|
||||
|
@ -71,7 +71,7 @@ void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_
|
|||
__clang_error_if(__bos_unevaluated_lt(__bos0(dst), copy_amount),
|
||||
"'mempcpy' called with size bigger than buffer") {
|
||||
size_t bos_dst = __bos0(dst);
|
||||
if (__bos_trivially_not_lt(bos_dst, copy_amount)) {
|
||||
if (__bos_trivially_ge(bos_dst, copy_amount)) {
|
||||
return __builtin_mempcpy(dst, src, copy_amount);
|
||||
}
|
||||
return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
|
||||
|
|
|
@ -76,7 +76,7 @@ char* getcwd(char* const __pass_object_size buf, size_t size)
|
|||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
size_t bos = __bos(buf);
|
||||
|
||||
if (!__bos_trivially_not_lt(bos, size)) {
|
||||
if (!__bos_trivially_ge(bos, size)) {
|
||||
return __getcwd_chk(buf, size, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
|
|
@ -305,14 +305,8 @@
|
|||
__bos_dynamic_check_impl_and(bos_val, op, index, 1)
|
||||
|
||||
#define __bos_trivially_ge(bos_val, index) __bos_dynamic_check_impl((bos_val), >=, (index))
|
||||
|
||||
#define __bos_trivially_gt(bos_val, index) __bos_dynamic_check_impl((bos_val), >, (index))
|
||||
|
||||
/* The names here are meant to match nicely with the __bos_unevaluated macros above. */
|
||||
#define __bos_trivially_not_lt __bos_trivially_ge
|
||||
#define __bos_trivially_not_le __bos_trivially_gt
|
||||
|
||||
|
||||
#if defined(__BIONIC_FORTIFY) || defined(__BIONIC_DECLARE_FORTIFY_HELPERS)
|
||||
# define __BIONIC_INCLUDE_FORTIFY_HEADERS 1
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue