diff options
Diffstat (limited to 'test/test/test_eal_flags.c')
-rw-r--r-- | test/test/test_eal_flags.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c index 37c42efe..f840ca50 100644 --- a/test/test/test_eal_flags.c +++ b/test/test/test_eal_flags.c @@ -33,7 +33,7 @@ #define memtest "memtest" #define memtest1 "memtest1" #define memtest2 "memtest2" -#define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10) +#define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 20) #define launch_proc(ARGV) process_dup(ARGV, \ sizeof(ARGV)/(sizeof(ARGV[0])), __func__) @@ -1138,10 +1138,11 @@ test_memory_flags(void) #ifdef RTE_EXEC_ENV_BSDAPP int i, num_sockets = 1; #else - int i, num_sockets = get_number_of_sockets(); + int i, num_sockets = RTE_MIN(get_number_of_sockets(), + RTE_MAX_NUMA_NODES); #endif - if (num_sockets <= 0 || num_sockets > RTE_MAX_NUMA_NODES) { + if (num_sockets <= 0) { printf("Error - cannot get number of sockets!\n"); return -1; } @@ -1151,11 +1152,12 @@ test_memory_flags(void) /* add one extra socket */ for (i = 0; i < num_sockets + 1; i++) { snprintf(buf, sizeof(buf), "%s%s", invalid_socket_mem, DEFAULT_MEM_SIZE); - snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf); + strlcpy(invalid_socket_mem, buf, sizeof(invalid_socket_mem)); if (num_sockets + 1 - i > 1) { snprintf(buf, sizeof(buf), "%s,", invalid_socket_mem); - snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf); + strlcpy(invalid_socket_mem, buf, + sizeof(invalid_socket_mem)); } } @@ -1167,11 +1169,12 @@ test_memory_flags(void) /* add one extra socket */ for (i = 0; i < num_sockets; i++) { snprintf(buf, sizeof(buf), "%s%s", valid_socket_mem, DEFAULT_MEM_SIZE); - snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf); + strlcpy(valid_socket_mem, buf, sizeof(valid_socket_mem)); if (num_sockets - i > 1) { snprintf(buf, sizeof(buf), "%s,", valid_socket_mem); - snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf); + strlcpy(valid_socket_mem, buf, + sizeof(valid_socket_mem)); } } |