|
|
25845f |
commit b2c9eff43c49d528c7ad3d0d91d03ccf0ae5ae0f
|
|
|
25845f |
Author: Joseph Myers <joseph@codesourcery.com>
|
|
|
25845f |
Date: Fri Feb 8 01:10:40 2013 +0000
|
|
|
25845f |
|
|
|
25845f |
Remove CHECK_BOUNDS_LOW and CHECK_BOUNDS_HIGH for C code.
|
|
|
25845f |
|
|
|
25845f |
diff --git a/string/strcpy.c b/string/strcpy.c
|
|
|
25845f |
index acc580ba3edb3073..812de20a3732cce5 100644
|
|
|
25845f |
--- a/string/strcpy.c
|
|
|
25845f |
+++ b/string/strcpy.c
|
|
|
25845f |
@@ -18,7 +18,6 @@
|
|
|
25845f |
#include <stddef.h>
|
|
|
25845f |
#include <string.h>
|
|
|
25845f |
#include <memcopy.h>
|
|
|
25845f |
-#include <bp-checks.h>
|
|
|
25845f |
|
|
|
25845f |
#undef strcpy
|
|
|
25845f |
|
|
|
25845f |
@@ -29,8 +28,8 @@ strcpy (dest, src)
|
|
|
25845f |
const char *src;
|
|
|
25845f |
{
|
|
|
25845f |
char c;
|
|
|
25845f |
- char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src);
|
|
|
25845f |
- const ptrdiff_t off = CHECK_BOUNDS_LOW (dest) - s - 1;
|
|
|
25845f |
+ char *__unbounded s = (char *__unbounded) src;
|
|
|
25845f |
+ const ptrdiff_t off = dest - s - 1;
|
|
|
25845f |
size_t n;
|
|
|
25845f |
|
|
|
25845f |
do
|
|
|
25845f |
@@ -41,8 +40,6 @@ strcpy (dest, src)
|
|
|
25845f |
while (c != '\0');
|
|
|
25845f |
|
|
|
25845f |
n = s - src;
|
|
|
25845f |
- (void) CHECK_BOUNDS_HIGH (src + n);
|
|
|
25845f |
- (void) CHECK_BOUNDS_HIGH (dest + n);
|
|
|
25845f |
|
|
|
25845f |
return dest;
|
|
|
25845f |
}
|
|
|
25845f |
diff --git a/sysdeps/generic/bp-checks.h b/sysdeps/generic/bp-checks.h
|
|
|
25845f |
index bf10617a3f6b8474..980f3b68a84df8cf 100644
|
|
|
25845f |
--- a/sysdeps/generic/bp-checks.h
|
|
|
25845f |
+++ b/sysdeps/generic/bp-checks.h
|
|
|
25845f |
@@ -24,16 +24,6 @@
|
|
|
25845f |
|
|
|
25845f |
# define BOUNDS_VIOLATED (__builtin_trap (), 0)
|
|
|
25845f |
|
|
|
25845f |
-/* Verify that pointer's value >= low. Return pointer value. */
|
|
|
25845f |
-# define CHECK_BOUNDS_LOW(ARG) \
|
|
|
25845f |
- (((__ptrvalue (ARG) < __ptrlow (ARG)) && BOUNDS_VIOLATED), \
|
|
|
25845f |
- __ptrvalue (ARG))
|
|
|
25845f |
-
|
|
|
25845f |
-/* Verify that pointer's value < high. Return pointer value. */
|
|
|
25845f |
-# define CHECK_BOUNDS_HIGH(ARG) \
|
|
|
25845f |
- (((__ptrvalue (ARG) > __ptrhigh (ARG)) && BOUNDS_VIOLATED), \
|
|
|
25845f |
- __ptrvalue (ARG))
|
|
|
25845f |
-
|
|
|
25845f |
# define _CHECK_N(ARG, N, COND) \
|
|
|
25845f |
(((COND) \
|
|
|
25845f |
&& (__ptrvalue (ARG) < __ptrlow (ARG) \
|
|
|
25845f |
@@ -56,8 +46,6 @@
|
|
|
25845f |
/* Do nothing if not compiling with -fbounded-pointers. */
|
|
|
25845f |
|
|
|
25845f |
# define BOUNDS_VIOLATED
|
|
|
25845f |
-# define CHECK_BOUNDS_LOW(ARG) (ARG)
|
|
|
25845f |
-# define CHECK_BOUNDS_HIGH(ARG) (ARG)
|
|
|
25845f |
# define CHECK_1(ARG) (ARG)
|
|
|
25845f |
# define CHECK_1_NULL_OK(ARG) (ARG)
|
|
|
25845f |
# define CHECK_N(ARG, N) (ARG)
|