]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
benchtests: Avoid overflow in random memcpy/memset benchmarks
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Tue, 20 May 2025 15:56:14 +0000 (15:56 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Mon, 4 Aug 2025 17:13:55 +0000 (17:13 +0000)
Use uint16_t rather than uint8_t for the size arrays.

benchtests/bench-memcpy-random.c
benchtests/bench-memset-random.c

index d17c784eb67809dfbb0e30100156bdd6d4e6d487..0734bc84aea937dff1efec1faa251a83a6db20b7 100644 (file)
@@ -34,7 +34,7 @@ typedef struct { uint8_t align; uint16_t freq; } align_data_t;
 
 #define SIZE_NUM 65536
 #define SIZE_MASK (SIZE_NUM-1)
-static uint8_t size_arr[SIZE_NUM];
+static uint16_t size_arr[SIZE_NUM];
 
 /* Frequency data for memcpy of less than 4096 bytes based on SPEC2017.  */
 static freq_data_t size_freq[] =
index 642bf411d482944949b6451f2426363e0de5115c..758c53bc6f5031dabd972a493ae800b50df5bb69 100644 (file)
@@ -39,7 +39,7 @@ typedef struct { uint8_t align; uint16_t freq; } align_data_t;
 
 #define SIZE_NUM 65536
 #define SIZE_MASK (SIZE_NUM-1)
-static uint8_t len_arr[SIZE_NUM];
+static uint16_t len_arr[SIZE_NUM];
 
 /* Frequency data for memset sizes up to 4096 bytes based on SPEC2017.  */
 static freq_data_t memset_len_freq[] =